I want to draw the orthocenter of a triangle in tikz. So, I tried to draw it in Geogebra and then tried to generate the tikz-code but it gave error message.

My questions are,

  • How to draw a triangle with orthocenter in tikz (if possible tell me how to accomplish the task in the way I was trying to do)?

  • If I try to draw the said figure in Geogebra,there are extra portions of lines which we don't need. How to remove this portions of the lines while drawing in tikz?

  • 2
    Note: Saying just 'it gave error message' tells us just about nothing, so if you're interested in removing an error, tell us at what stage you get the error, and what exactly the message said. – Torbjørn T. Jun 22 '15 at 9:35

I don't know GeoGebra, but here's how you can do it with just Tikz.

I added the code for the angles to show the right angles (they are automatically shown, rounded to 0 decimal numbers).


figure 1


\usepackage{tikz, tkz-euclide}



\coordinate[label=left:{$A$}]  (A) at (0,0);
\coordinate[label=right:{$B$}] (B) at (6,0);
\coordinate[label=above:{$C$}] (C) at (3,6);
\draw[very thick] (A) -- (B) -- (C) -- cycle;

\coordinate (a) at ($(B)!(A)!(C)$);
\coordinate (b) at ($(A)!(B)!(C)$);
\coordinate (c) at ($(A)!(C)!(B)$);

\draw[dashed] (A) -- (a);
\draw[dashed] (B) -- (b);
\draw[dashed] (C) -- (c);

\coordinate [label=45:$O$] (O) at (intersection of A--a and B--b);
\fill (O) circle (1pt);

% showing the angles
\tkzGetAngle{angleAaC}; \FPround\angleAaC\angleAaC{0}
\tkzGetAngle{angleCcA}; \FPround\angleCcA\angleCcA{0}
\tkzGetAngle{angleBbC}; \FPround\angleBbC\angleBbC{0}
\tkzLabelAngle[pos=-.5](A,a,C){\tiny $\angleAaC^\circ$}
\tkzLabelAngle[pos=.5](C,c,A){\tiny $\angleCcA^\circ$}
\tkzLabelAngle[pos=.6](B,b,C){\tiny $\angleBbC^\circ$}


a solution with tikz






\coordinate (A) at (0,0)node[below=0em  of A]{A};
\coordinate (B) at (4,5)node[right=0em of B]{B};
\coordinate (C) at (-2,6)node[left=0em of C]{C};

\draw (A) -- (B) -- (C)--(A);

\draw[name path=CC] ($(A)!(C)!(B)$) -- (C);
\draw[name path=BB] ($(A)!(B)!(C)$) -- (B);
\draw ($(B)!(A)!(C)$) -- (A);

\fill[red,name intersections={of=CC and BB}]
    (intersection-1) circle (2pt) node[above right] {I};


enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.