Solution (source code)

= Solution

Choose the first $r$ <left singular vectors>:
$$
\boxed{Q_*=[u_1,\ldots,u_r]}.
$$
Their <orthonormality> gives $Q_*^TQ_*=I_r$. The <orthogonal projection> $Q_*Q_*^T$ fixes $u_j$ for $j\leq r$ and annihilates $u_j$ for $j>r$. Applying it to the <singular value decomposition> therefore gives
$$
Q_*Q_*^TA=\sum_{j=1}^r\sigma_j u_jv_j^T=A_r.
$$