Many approaches are possible.

One approach is (wlog) to let the square's sidelength be equal to 1. Then note that and , use the cosine rule on triangle MAN to get and then use the Pythagorean Identity to get .

(But the problem is that we don't know your mathematical background, so who knows what approaches you will understand and what ones you won't ....)