# Tikz diagrams and node placements

I'm designing a diagram for a 1-D potential well. I'm struggling to correctly place my a label below the right hand line. I resorted to drawing an invisible line and positioning the node at the end. Further to this, how do I add grey shading to the area outside of the red lines?

Cheers

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[-stealth] (-0.5,0) -- (pi,0) node[right]{$$x$$};
\draw[-stealth] (0,-0.5) -- (0,4) node[above]{$$V(x)$$};
\draw[thick, red, ->, >=stealth] (0,0) -- (0,3) node[left, blue]{};
\draw[thick, red,->, >=stealth] (2.5,0) -- (2.5,3);
%       \node[draw] at (2.5,-0.2)  node[right, black]{$$a$$};
\draw[line width=0pt] (0,0) -- (2.5,0) node[below, black]{$$a$$};
\end{tikzpicture}
\end{document}


Like this

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\fill[gray!50] (-.5,-.5) rectangle (pi,4);
\fill[white] (0,0) rectangle (2.5,3);
\draw[-stealth] (-0.5,0) -- (pi,0) node[right]{$$x$$};
\draw[-stealth] (0,-0.5) -- (0,4) node[above]{$$V(x)$$};
\draw[thick, red, ->, >=stealth] (0,0) -- (0,3) node[left, blue]{$$x$$};
\draw[thick, red,->, >=stealth] (2.5,0) node[below,black] {$a$} -- (2.5,3);
\end{tikzpicture}
\end{document}


Note that if you want to draw an invisible line, you should not use line width=0pt, because it is still greater that zero. Use \path instead (in fact \draw and \path[draw] are the same):

\path (0,0) -- (2.5,0) node[below, black]{$$a$$};