2. Find the value of the expression $\frac{a}{b}+\frac{b}{a}$, where $a$ and $b$ are the largest and smallest roots of the equation $x^{3}-7 x^{2}+7 x=1$, respectively.
Answer: 34.

Solution. The given equation is equivalent to the following

$$
\left(x^{3}-1\right)-7\left(x^{2}-x\right)=0 \Leftrightarrow(x-1)\left(x^{2}+x+1\right)-7 x(x-1)=0 \Leftrightarrow(x-1)\left(x^{2}-6 x+1\right)=0,
$$

from which $x=1$ or $x=3 \pm \sqrt{8}$. The largest root is $a=3+\sqrt{8}$, and the smallest is $-b=3-\sqrt{8}$. Then

$$
\frac{a}{b}+\frac{b}{a}=\frac{3+\sqrt{8}}{3-\sqrt{8}}+\frac{3-\sqrt{8}}{3+\sqrt{8}}=\frac{(3+\sqrt{8})^{2}+(3-\sqrt{8})^{2}}{(3+\sqrt{8})(3-\sqrt{8})}=\frac{2(9+8)}{1}=34
$$