How is this problem solved

Your question seems to be "how do you solve this?" The answer is ...
make use of the relationships between sides and trig functions for angles in a right triangle.
___
The useful relationships here are ...
Sin = Opposite/Hypotenuse . . . . sin(A) = 9/15 = 3/5; sin(B) = 12/15 = 4/5
Cos = Adjacent/Hypotenuse . . . . cos(A) = 12/15 = 4/5; cos(B) = 9/15 = 3/5
You will notice that sin(A) = cos(B) and sin(B) = cos(A).
The relationship for tangent is ...
Tan = Opposite/Adjacent . . . . tan(A) = 9/12 = 3/4; tan(B) = 12/9 = 4/3
You will notice that tan(A) = 1/tan(B) and vice versa.
___
These relationships are summed up in the mnemonic SOH CAH TOA. It may help to think of this as a name in some language.