Given a matrix $M \times N$, how to prove that the number of diagonals that can be drawn, like in the figure below, is equal to $M + N - 1$?
My idea would be to prove it with induction and consider the 3 possible cases: $M=N$, $M>N$ and $M<N$. But I don't know how to do it.

This is a counting problem.
Start at the first row and count diagonals passing through elements on the first row. You get $N$ of those.
Now go down through the last column and you get $M$ of those.
There is one which is counted twice, so the total is $M+N-1$