Finding the inverse for this graph seems to be challenging so I now want to reflect the red part of the graph in the line y=x.
How would do this in latex?
Thank you!
\documentclass[]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{pgfplots}
\renewcommand{\thesection}{\arabic{section}}
\usepackage{mathtools}
\usepackage{cancel}
\usepackage{pgfplots}
\usepackage{amsmath}
\newtheorem{theorem}{THEOREM}
\newtheorem{proof}{PROOF}
\usepackage{tikz}
\usepackage{amssymb}
\usetikzlibrary{patterns}
\usepackage{fancyhdr}
\usepackage{bigints}
\usepackage{color}
\usepackage{tcolorbox}
\usepackage{color,xcolor}
\usepackage{booktabs,array}
\usepackage{hyperref}
\usepackage{graphicx}
\usetikzlibrary{arrows}
\usepackage{polynom}
\usepackage{wallpaper}
\usetikzlibrary{shapes.geometric}
\usepgfplotslibrary{fillbetween}
\newenvironment{tightcenter}{
\setlength\topsep{0pt}
\setlength\parskip{0pt}
\begin{center}}{\end{center}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
axis line style=thick,
axis line style={->},
%minor tick num=5,
%grid=both,
%grid style={line width=.1pt, draw=gray!30},
%major grid style={line width=.2pt,draw=gray!50},
%ticks=none,
xmin=-0.5,
xmax=4.6,
ymin=-0.3,
ymax=1.1,
height=12cm,
width=15cm,
%label style={font=\normalsize},
xlabel=$x$,
ylabel=$y$,
ticks=none,
clip=false,
%every tick label/.append style={font=\tiny},
ylabel style={
anchor=south,
at={(ticklabel* cs:1.0)},
yshift=1pt
},
xlabel style={
anchor=west,
at={(ticklabel* cs:1.0)},
xshift=1pt
}
]
%\addplot[name path=func1,thick,color=black,samples=120,domain=-0.05:4.5] {2*x*exp(-2*x+1)};
\addplot[name path=func2,thick,color=black,samples=120,domain=-0.325:4.5] {2*x^2*exp(-2*x+1)};
\addplot[name path=func2,thick,color=red,samples=120,domain=1:4.5] {2*x^2*exp(-2*x+1)};
%
\node[below] at (axis cs:-0.07,0) {$O$};
%\addplot fill between[
%of = func1 and func2,
%soft clip={domain=0:1},
%every even segment/.style = {gray,opacity=.3}
%];
\end{axis}
\end{tikzpicture}
\end{document}




