Use the substitution $\displaystyle y=3^x $to solve the equation $\displaystyle 3^{2x}-10 . 3^x+9=0$

the problem i need explaining is the first part involving the subsitution for $\displaystyle y^2$. how does $\displaystyle 3^{2x}$ become $\displaystyle y^2$

$\displaystyle y^2-10y+9=0$

$\displaystyle (y-1)(y-9)=0$

.....

i can see how the rest of the problem is solved as i have the solution

many thanks