Answer
$w^2-5w+7$
Work Step by Step
Given \begin{equation}
\left(w^4-5w^3+w^2+30w-42\right) \div\left(w^2-6\right).
\end{equation} Use long division. $$
\begin{array}{r}
w^2-5w+7\phantom{)} \\
w^2-6{\overline{\smash{\big)}\,w^4-5w^3+w^2+30w-42\phantom{)}}}\\
\underline{-~\phantom{(}(w^4-6w^2)\phantom{-b)}}\\
0-5w^3+7w^2+30w\phantom{)}\\
\underline{-~\phantom{()}(-5w^3+30w)}\\
0+7w^2-42\phantom{)}\\
\underline{-~\phantom{()}(7w^2-42)}\\
0\phantom{)}
\end{array}
$$ The solution is \begin{equation}
\frac{w^4-5w^3+w^2+30w-42}{w^2-6}= w^2-5w+7.
\end{equation}