Show that $AM^2=p(p-a)$

This is a Sangaku, "one of Japanese geometrical problems or theorems on wooden tablets which were placed as offerings at Shinto shrines or Buddhist temples during the Edo period by members of all social classes". A good book describing these problems can be found on Amazon.

enter image description here

A solution of your problem can be found on Cut-the-Knot.

This well-known problem also has a slightly different form.

Prove that:

$$\cos\angle BMA=\frac{b-c}a$$

You can find two different proofs on Cut-the-Knot here.