Example 3. The area of $\triangle ABC$ is 3 times the area of its inscribed rectangle $PQRS$, and the values of side $BC$ and altitude $AD$ are rational numbers. Under what conditions is the perimeter of rectangle $PQR$ a rational number? Under what conditions is it an irrational number?
(1985, Joint Mathematics Competition of Guangzhou, Fuzhou, and other cities)
As shown in the figure, let $BC = a$, $AD = h$, $PQ = m$, $PS = n$. We have $\frac{h-n}{h} = \frac{m}{a}$, which means
$$
\begin{array}{l}
mh + an = ah. \\
\text{Also, } mn = \frac{1}{3} \cdot \frac{1}{2} ah = \frac{1}{6} ah, \\
\therefore \quad mh \cdot an = \frac{1}{6} a^2 h^2.
\end{array}
$$

From (1) and (2), we know that $hm$ and $an$ are the roots of the equation
$$
x^2 - ahx + \frac{1}{6} a^2 h^2 = 0.
$$

Solving this equation, we get
$$
x_{1,2} = \frac{1}{6}(3 \pm \sqrt{3}) ah.
$$

Thus, the perimeter of rectangle $PQRS$ is
$$
2(m+n) = a + h \pm \frac{\sqrt{3}}{3}(a - h).
$$

Therefore, when $a = h$, the perimeter of rectangle $PQRS$ is a rational number;

when $a \neq h$, the perimeter of rectangle $PQRS$ is an irrational number.