First, what do you mean by "addition of two vector magnitudes". If you mean "find the magnitude of the sum of two vectors, having magnitudes A and B", then what you give is true only if the two vectors are perpendicular- it is from the Pythagorean theorem which applies to right triangles.

This is the magnitude of the sum of two vectors having magnitudes A and B which form angle

, not necessarily perpendicular. Notice that if

, then

so you get the same thing as before. It is from the cosine law that generalizes the Pythagorean theorem to general triangles.