You could prove it with inner products and norms but the way you have used is pretty good and a lot easier.
Prove that if a triangle has sides of lengths a, b and c, such that a2 + b2 = c2 then the triangleis right angled.
The only thing i was thinking is cosing law. so
a2 + b2-2abcos(x)= c2 and so -2abcos(x)=0 therefore x=90degrees
Is there a more elegant way to prove this?