Extend the line segment AM until it touches AC, and call that intersection point P. Triangle AMP then forms a pair of similar triangles:

From this we know that angles MDP and AMP are congruent, and we already know MDP is a right angle so it follows that
.
(You can ignore most of the labels in the image; I realized moments later after posting that the proof is much simpler than I originally thought)