7. On side $AB$ of triangle $ABC$, a point $D$ is taken. In triangle $ADC$, the angle bisectors $AP$ and $CQ$ are drawn. On side $AC$ of triangle $ADC$, a point $R$ is taken such that $PR \perp CQ$. It is known that the angle bisector of angle $D$ of triangle $BCD$ is perpendicular to segment $PB$, $AB=18$, $AP=12$. Find $AR$. 8.
Solution. Let $A B=n, A P=m, A D=c, A C=b, D P=p, C P=q, B D=D P=p, C P=C R=q$.

Using the property of the angle bisector and the formula for the length of the angle bisector, we get $\left\{\begin{array}{l}\frac{c}{b}=\frac{p}{q}, \\ c+p=A B=n, \\ m^{2}=b c-p q,\end{array}\right.$

$\left\{\begin{array}{l}c=\frac{b p}{q}, \\ \frac{b p}{q}+p=n, \\ m^{2}=b \frac{b p}{q}-p q:\end{array}\left\{\begin{array}{l}c=\frac{b p}{q}, \\ b p+p q=q n, \\ m^{2}=b \frac{b p}{q}-p q,\end{array}\left\{\begin{array}{l}c=\frac{b p}{q}, \\ p=\frac{q n}{b q}, \\ m^{2}=b \frac{b}{q} \frac{q n}{b+q}-q \frac{q n}{b+q}:\end{array} m^{2}=\frac{b^{2} n}{b+q}-\frac{q^{2} n}{b+q}, m^{2}=\frac{\left(b^{2}-q^{2}\right) n}{b+q}:\right.\right.\right.$ $m^{2}=\frac{(b-q)(b+q) n}{b+q}, m^{2}=(b-q) n, b-q=\frac{m^{2}}{n}, b-q=\frac{12^{2}}{18}=8$.