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?