II. Given two skew lines $a, b$ forming an angle $\theta$, and their common perpendicular $A^{\prime} A$ has a length of $d$. Take points $E, F$ on lines $a, b$ respectively, with $A^{\prime} E=m, A F=n$. Find $E F$. ($A^{\prime}$ is on line $a$, $A$ is on line $b$)
Let the plane passing through $b$ and parallel to $a$ be $\alpha$, and the plane passing through $a$ and $A A^{\prime}$ be $\beta$. Let $\alpha \cap \beta = c$. Then $c \parallel a$. Therefore, the angle between $b$ and $c$ is $\theta$, and $A A^{\prime} \perp c$,
$$
\begin{array}{l}
\text { Also, since } \quad A A^{\prime} \perp b, \\
\therefore \quad A A^{\prime} \perp \alpha .
\end{array}
$$

According to the theorem for determining perpendicular planes,
$$
\beta \perp \alpha .
$$

In the plane $\beta$, construct $E G \perp c$,
then $E G \perp \alpha$.
Connect $F G$, then $E G \perp F G$, in the right triangle $F E G$,
$$
\begin{array}{c}
E F^{2}=E G^{2}+F G^{2} . \\
A G=m .
\end{array}
$$
$$
\because \quad A G=m \text {. }
$$
$\therefore$ In $\triangle A F G$, $F G^{2}=m^{2}+n^{2}-2 m n \cos \theta$.
Also $\because$
$$
E G^{2}=A A^{\prime 2}=d^{2} .
$$
$$
\therefore \quad E F^{2}=d^{2}+m^{2}+n^{2}-2 m n \cos \theta \text {. }
$$

If point $F$ (or $E$) is on the other side of point $A$ (or $A^{\prime}$),
then
$$
E F^{2}=d^{2}+m^{2}+n^{2}+2 m n \cos \theta \text {. }
$$

Therefore,
$$
E F=\sqrt{d^{2}+m^{2}+n^{2} \pm 2 m n \cos \theta} .
$$