I am preparing a geometry note file for my students and I am trying to reproduce a figure I saw on Wikipedia in the proof of the Pythagorean theorem. Here is the figure enter image description here

I can draw a right triangle with tikz after some trial and error, but I do not know how to color the interiors of the shapes, label the vertices, label the angles as nicely as shown in the figure below, drop a perpendicular, and mark the angles with arcs or a square for a right angle as in H and C vertices. I am a math teacher by profession and my computer and TeX proficiency are minimal. I would certainly appreciate any help with this. My aim is to create my own figures so as not to plagiarize. I thank all helpers.

Edit: here is my code for a right triangle


\coordinate (A) at (-1.5cm,-1.cm);
\coordinate (C) at (1.5cm,-1.0cm);
\coordinate (B) at (1.5cm,1.0cm);
\draw (A) --  (B) --  (C) -- (A);

  • 1
    Welcome to TeX.SE. Could you post the code for your right triangle? That would give us something to start from.
    – Teepeemm
    Aug 3, 2021 at 20:40
  • 2
    You might want to try geogebra classic, it can export tikz code
    – DG'
    Aug 3, 2021 at 20:45
  • @Teepeemm thank you for your suggestion, I have added my code
    – user209867
    Aug 3, 2021 at 20:48
  • 1
    Since the two interior triangles are similar (to each other and the outer triangle) it would help to use easily rotated triangles, like 3-4-5 or 30-60-90 (1-2-\sqrt{3}). Aug 3, 2021 at 20:53
  • You seem to be working your way through proofs of Pythagoras' theorem. Let me know when you get to the correct one, and I can provide the code for it as seen in loopspace.mathforge.org/CountingOnMyFingers/FavouriteProof Aug 3, 2021 at 20:56

3 Answers 3


I propose this solution with the pst-eucl module of pstricks, which can mimick constructions of plane geometry:



\psset{PointSymbol=none, linejoin=1,CodeFigStyle=solid, CodeFigColor=black}
\psset{MarkAngleRadius=0.8, RightAngleSize=0.25, LabelSep=0.6}%, LabelSep=-0.2cm}
\pstMarkAngle{H}{C}{A}{$\theta$} \pstMarkAngle{B}{C}{H}{}\pstMarkAngle{B}{C}{H}{}
\pstRightAngle{B}{C}{A} \pstRightAngle{C}{H}{A}


enter image description here

  • thank you so much. Small question if I may ask. How would I also mark the HCB angle with 90-\theta for maximum clarity?
    – user209867
    Aug 3, 2021 at 23:40
  • 1
    You may, of course: we're here to help. Actually, it is already marked with the smaller \MarkAngleRadius (I copied your posted image with the pstricks tools). But if you think the larger is confusional, you may use colour the markings for this angle and for the corresponding angle CAH, for instance. Or colour the theta angles. To colour the angles, e.g. in red, use\pstMarkAngle[linecolor=red]{…}.
    – Bernard
    Aug 4, 2021 at 9:16
  • thank you so kindly, after reading and learning your code, I copied it into my document and it is giving several errors. It does not seem to be recognizing anything in the pspicture environment. I loaded the two packages in the order you gave, in addition to my other used packages. Could you please advise? Thank you.
    – user209867
    Aug 4, 2021 at 17:51
  • 1
    @kroner: Which compiler did you use?
    – Bernard
    Aug 4, 2021 at 18:13
  • 1
    That doesn't tell how you compiled. The simplest is to use xelatex with the --shell-escape switch
    – Bernard
    Aug 4, 2021 at 18:18

With the help of quotes and angles libraries, it's not difficult to get it.

\usetikzlibrary{calc, angles, quotes, backgrounds}

\draw (0,0) node[below left] {$C$} coordinate (C) -- (0,3) node[above left] {$A$} coordinate (A) -- (5,0) node[below right] {$B$} coordinate (B)--cycle;
\draw (C)--($(A)!(C)!(B)$) coordinate (H) node[above right]{$H$};

\begin{scope}[on background layer]
\fill[blue!30] (B)--(C)--(H)--cycle;
\fill[green!30] (A)--(C)--(H)--cycle;

\draw pic[draw] {angle=C--A--H} pic[draw, angle radius=4mm] {angle=C--A--H};
\draw pic["$\theta$",draw, angle radius=7mm, angle eccentricity=.8] {angle=H--B--C};
\draw pic["$\theta$",draw, angle radius=8mm, angle eccentricity=.8] {angle=H--C--A};
\draw pic[draw, angle radius=8mm] {angle=B--C--A}  pic[draw, angle radius=7mm] {angle=B--C--H};

\draw pic[draw, angle radius=3mm] {right angle=B--C--A};
\draw pic[draw, angle radius=3mm] {right angle=C--H--A};


enter image description here


This uses a 3-4-5 triangle.


\coordinate (A) at (0,0);
\coordinate (C) at (0,3);
\coordinate (B) at (4,0);
\coordinate (D) at ($(C)!{9/25}!(B)$);% see derivation below
\draw (A) -- (B) -- (C) -- cycle;
\draw (A) -- (D);
\path pic [draw,angle radius=2mm] {right angle = C--A--B}
      pic [draw,angle radius=2mm] {right angle = A--D--B};
\fill[red, opacity=0.5] (A) -- (B) -- (D);
\fill[blue, opacity=0.5] (A) -- (C) -- (D);
\node[below left] at (A) {A};
\node[below right] at (B) {B};
\node[above left] at (C) {C};
\node[above right] at (D) {D};



You must log in to answer this question.