To memorize the formula, you can directly use:
What is the projection of A on B? The modulus of Ab times b.
What is the projection of B in A? The modulus of Ab times a.
The specific proof process is shown in the figure, which does not need memory, but only helps to understand the formula.