Solution (source code)

= Solution

Let $u_j$ and $v_j$ be the columns of the <orthogonal matrices> $U$ and $V$ in the <singular value decomposition>. Multiplying by the rectangular <diagonal matrix> retains its $r$ nonzero diagonal entries:
$$
A=U\Sigma V^T=\boxed{\sum_{j=1}^r\sigma_j u_jv_j^T.}
$$
The families $(u_j)$ and $(v_j)$ are <orthonormal>, hence in particular <orthogonal>. Each summand is a rank-one <outer product>, and the remaining terms vanish because their <singular values> are zero.