Solution (source code)

= Solution

Choose <bases> of $V$ and $W$, of dimensions $v$ and $w$. A <linear map> is uniquely determined by the arbitrary images of the $v$ <basis> <vectors>, each with $w$ coordinates, so
$$
\dim L(V,W)=vw.
$$

Put $a=\dim A$ and $b=\dim B$, and extend <bases> of $A,B$ to <bases> of $V,W$. The condition $\phi(A)\subseteq B$ forces the $(w-b)a$ <matrix> entries from $A$ to a complement of $B$ to vanish and imposes no other restriction. Hence
$$
\dim X=vw-a(w-b).
$$

For the last part let $r=\dim(S\cap T)=s+t-v$. Choose
$$
V=(S\cap T)\oplus S_0\oplus T_0.
$$
A map in $Y$ sends $S\cap T$ into itself, $S_0$ into $S$, and $T_0$ into $T$, with these choices independent. Therefore
$$
\boxed{\dim Y=r^2+s(s-r)+t(t-r),
\qquad r=s+t-v.}
$$