I have a typical geometric construction that I want to draw using TikZ. The following code gives a line segment PQ. How do I get TikZ to draw a point on the line perpendicular to PQ and through P that is 2\sqrt{2} units below the line segment PQ? I think that I have to have \usetikzlibrary{calc} in the preamble to do this. (I want to label this point R and draw right triangle QPR.) If I want to use \tkzMarkRightAngle(Q,P,R); to indicate that the triangle is a right triangle, do I have to have \usepackage{tkz-euclide} in the preamble?
\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning,intersections,quotes}
\begin{document}
\begin{tikzpicture}
\draw[yellow, line width=0.1pt] (-1.75,-1.75) grid[xstep=0.5, ystep=0.5] (2.75,1.75);
\draw[draw=gray!30,latex-latex] (0,1.75) +(0,0.25cm) node[above right] {$y$} -- (0,-1.75) -- +(0,-0.25cm);
\draw[draw=gray!30,latex-latex] (-1.75,0) +(-0.25cm,0) -- (2.75,0) -- +(0.25cm,0) node[below right] {$x$};
\node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]left:$P$}] (P) at (-1,-1) {};
\node[outer sep=0pt,circle, fill,inner sep=1.5pt, label={[fill=white]right:$Q$}] (Q) at (2,1) {};
\draw[green!20!white] (P) -- (Q);
\end{tikzpicture}
\end{document}




\coordinate (R) at ($(P)!2\sqrt{5}!90:(Q)$);and got an error message. It seems to me that TikZ could not interpret\sqrt{5}as part of a measurement. I changed the command to\coordinate (R) at ($(P)!1!90:(Q)$);and nothing was plotted. I think that I need to havecmas the units. Isn'tcmthe default unit assigned to a number? I changed the command to\coordinate (R) at ($(P)!1cm!90:(Q)$);and nothing was plotted. – user74973 Apr 21 '15 at 00:56\node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]above left:$R$}] (R) at R {};putting a dot at R? – user74973 Apr 21 '15 at 00:57