Consider the triangle ABC. Denote h the altitude through B and D the point where h intersects the (extended) base AC
Cosine function for triangle ADB.
cos α= x/c => x=c*cos α
Pythagorean theorem for triangle ADB
x2+h2=c2*x2+h2=c2
h2=c2−x2*h2=c2−x2
Pythagorean theorem for triangle CDB
(b−x)2+h2=a2*(b−x)2+h2=a2
Substitute h2 = c2 - x2
(b−x)2+(c2−x2)=a2(b−x)2+(c2−x2)=a2
(b2−2bx+x2)+(c2−x2)=a2(b2−2bx+x2)+(c2−x2)=a2
b2−2bx+c2=a2b2−2bx+c2=a2
Substitute x = ccos α
b2−2b(ccosα)+c2=a2b2−2b(c*cos α)+c2=a2
Rearrange to get Law of Cosines
a2=b2+c2−2bc*cos α