Example 2. Let $p \neq 0$, and the quadratic equation with real coefficients $z^{2}-2 p z+q=0$ has imaginary roots $z_{1}$ and $z_{2}$. The corresponding points of $z_{1}$ and $z_{2}$ in the complex plane are $Z_{1}$ and $Z_{2}$. Find the length of the major axis of the ellipse with foci at $Z_{1}$ and $Z_{2}$ and passing through the origin. (84 National College Entrance Examination)
From formula (1) combined with the concept of the modulus of a complex number and the arithmetic root, we get
$$
\begin{aligned}
\left|z_{1}-z_{2}\right| & =\sqrt{\left|z_{1}-z_{2}\right|^{2}} \\
& =\sqrt{\left|z_{1}^{2}+z_{2}^{2}-2 z_{1} z_{1}\right|} \\
& =\sqrt{\left|\left(z_{1}+z_{2}\right)^{2}-4 z_{1} z_{2}\right|} .
\end{aligned}
$$

By Vieta's formulas, we know that $z_{1}+z_{2}=2 p, z_{1} z_{2}=q$.
The length of the major axis $2 b=\left|z_{1}+z_{2}\right|=|2 p|=2|p|$,
The focal distance $2 c=\left|z_{1}-z_{2}\right|$
$$
\begin{array}{l}
=\sqrt{\left|\left(z_{1}+z_{2}\right)^{2}-4 z_{1} z_{2}\right|} \\
=\sqrt{\left|4 p^{2}-4 q\right|} \\
=2 \sqrt{q-p^{2}} .
\end{array}
$$

Therefore, the length of the semi-major axis $2 a=2 \sqrt{b^{2}+c^{2}}$
$$
\begin{array}{l}
=2 \sqrt{p^{2}+\left(q-p^{2}\right)} \\
=2 \sqrt{q} .
\end{array}
$$