# How could I graph z=sqrt(x^2-y^2) using Pgftools? I believe I've all suggestions on the internet but to no avail

I have tried graphing it with the parametric notation (i.e. ({x},{y},{sort(x^2-y^2)}) and as seen on my code below but nothing renders the image shown on graphing calculators.

\begin{tikzpicture}[scale=1.5]
\begin{axis}[
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
surf,
samples=50,
z buffer=sort,
]  {sqrt((x)^2-(y)^2)};

\end{axis}
\end{tikzpicture}


You did almost everything right, pgfplots is just not very good at taking the square root of a negative number. So if you adjust the domains a bit you get

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}[scale=1.5]
\begin{axis}[
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
surf,
samples=50,
z buffer=sort,
]  {sqrt(x^2-y^2)};

\end{axis}
\end{tikzpicture}
\end{document}


As for your request in the comments, one can write the function as sqrt(u*v), where u=x+y and v=x-y. Then x=(u+v)/2 and y=(u-v)/2. Since the variables are just placeholders in a parametric plot, we can rename u and v to x and y, respectively, and arrive at

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}[scale=1.5]
\begin{axis}[xmax=2,xmin=-2,
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
surf,
samples=50,
z buffer=sort,
] ({(x+y)/2},{(x-y)/2},{sqrt(x*y)});
surf,