Orthocenter of a triangle

3367 days ago by Kris.Coolsaet

We shall prove that the altitudes of a triangle intersect in a common point.

We choose the coordinates of the vertices $A,B,C$ of the triangle in such a way that the base of the altitude through $C$ on $AB$ has coordinates $(0,0)$, as follows \[A: (a,0)\quad B:(b,0)\quad  C: (0,c).\] The base of the altitude through $A$ is given coordinates $x_a,y_a$, the base of the altitude through $B$ is given coordinates $x_b,y_b$. The intersection point of the altitude through $A$ with the altitide through $C$ is of the form $(0,y)$. We need to prove that the third altitude also goes through this point.

R = QQ['a,b,c,x_a,y_a,x_b,y_b,y,Y_a'] a,b,c,x_a,y_a,x_b,y_b,y,Y_a = R.gens() 
       

(The variable $Y_a$ which we have introduced here, will be used at the end of this worksheet)

We introduce two functions that return polynomials that represent collinearity and the fact that two lines are perpendicular

def collinear(x_1,y_1,x_2,y_2,x_3,y_3): return matrix ([[x_1,y_1,1],[x_2,y_2,1],[x_3,y_3,1]]).determinant() def perpendicular(x_1,y_1,x_2,y_2,x_3,y_3): return (x_1-x_2)*(x_2-x_3) + (y_1-y_2)*(y_2-y_3) 
       

The following polynomials represent the conditions for the theorem

altitudeA = perpendicular(a,0,x_a,y_a,b,0) altitudeB = perpendicular(a,0,x_b,y_b,b,0) sideBC = collinear(b,0,x_a,y_a,0,c) sideAC = collinear(a,0,x_b,y_b,0,c) collinearA = collinear(a,0,x_a,y_a,0,y) 
       

And this is what we would like to prove:

collinearB = collinear(b,0,x_b,y_b,0,y) 
       

We use the standard Gröbner basis technique:

I = Ideal(altitudeA,altitudeB,sideBC,sideAC,collinearA) G = I.groebner_basis ('libsingular:std') collinearB.reduce(G) 
       

                                
                            

                                

Oh no! It does not work. 

The expression we see here is the value of collinearB itself and not 0 as we expected. What did we do wrong?

A hint of why things go wrong is given by the 5th element of our basis:

G[6].factor() 
       

                                
                            

                                

It follows that we can only prove that the three points are collinear provided $y_a,y_b\ne 0$!

One of the reasons these extra conditions crop up is the fact that our 'perpendicular' condition is only really useful when none of the endpoints $(x_1,y_1),(x_3,y_3)$ coincides with the midpoint $(x_2,y_2)$.

We may try to salvage this by adding two more orthogonality conditions:

altitudeA2 = perpendicular(a,0,x_a,y_a,0,c) altitudeB2 = perpendicular(0,c,x_b,y_b,b,0) I = Ideal(altitudeA,altitudeB,sideBC,sideAC,collinearA,altitudeA2,altitudeB2) G = I.groebner_basis ('libsingular:std') collinearB.reduce(G) 
       

                                
                            

                                

As you see, this does not really help, although the Gröbner basis has become a little simpler.

G[3].factor() 
       

                                
                            

                                

There is a trick we can use to indicate that we require $y_a\ne 0$, although Gröbner bases can only work with condition of equality to zero: we introduce a new variable $Y_a$ that represents the inverse of $y_a$ and add the condition $y_aY_a=1$.

I = Ideal(altitudeA,altitudeB,sideBC,sideAC,collinearA,altitudeA2,altitudeB2, y_a*Y_a-1) G = I.groebner_basis ('libsingular:std') collinearB.reduce(G) 
       

                                
                            

                                

QED