The cosine rule,
a2=b2+c2-2bccosA,
where a, b, & c are the sides of a triangle and A is the angle opposite side a, is the general version of Pythagoras' Theorem and applies to any triangle, not just right angled triangles.
The cosine rule should be used when you encounter a problem involving all 3 sides of a triangle and 1 internal angle. For example you are given the length of 2 sides and the angle between them and you are asked to find the length of the third side.