Solution (source code)

= Solution

Take $S=T(B_X)$. A <bounded linear operator> is compact exactly when the closure of this set is compact. In a <complete metric space> this is equivalent to its being <totally bounded>.

If $T$ is compact, choose a finite $\varepsilon$-net $z_1,\ldots,z_m$ for $T(B_X)$ and let $Y$ be their span. Then $\operatorname{dist}(Tx,Y)<\varepsilon$ for $\|x\|\leq1$, giving $\|\pi_YT\|\leq\varepsilon$.

Conversely, fix $\delta>0$ and take $Y$ with $\|\pi_YT\|\leq\delta/4$. For every $x\in B_X$ choose $y_x\in Y$ with $\|Tx-y_x\|<\delta/2$. These approximants satisfy $\|y_x\|\leq\|T\|+\delta/2$, so form a bounded subset of a finite-dimensional space and have a finite $\delta/2$-net. The same centers give a finite $\delta$-net for $T(B_X)$. Thus it is <totally bounded> and $T$ is compact. In particular
$$
\boxed{T\text{ compact}\iff\forall\varepsilon>0\ \exists\dim Y<\infty:\ \|\pi_YT\|\leq\varepsilon.}
$$