We begin by letting \(x\) be the distance from \(Z\) to \(Q\text{.}\) Since it is \(3\) km from \(P\) to \(Q\text{,}\) the distance from \(P\) to \(Z\) is \(3-x\) km. Furthermore, we can use the Pythagorean Theorem to find that the distance from \(Z\) to the cabin is \(\sqrt{4+x^2}\) km.
Next we want to determine the hiker’s time as a function of \(x\text{.}\) Because distance equals rate times time, it follows that time is distance divided by rate. The hiker travels along the road for \(3-x\) km at a pace of \(8\) km/hr, thus her time on the road is
\begin{equation*}
T_r = \frac{3-x}{8} \text{ hr}\text{.}
\end{equation*}
Once she enters the woods, her pace drops to \(3\) km/hr and she continues for \(\sqrt{4+x^2}\) km before reaching the cabin. She spends a total of
\begin{equation*}
T_w = \frac{\sqrt{4+x^2}}{3}
\end{equation*}
hours hiking in the woods.
Altogether, the time it takes the hiker to reach the cabin is given by the function
\begin{equation*}
T(x) = \frac{3-x}{8} + \frac{\sqrt{4+x^2}}{3}\text{.}
\end{equation*}
Because the only values of \(x\) that make sense to use are \(0 \le x \le 3\) (since walking away from or past \(Q\) before turning to the cabin both add unnecessary time to the trip), we use this domain for \(T\) and now seek the absolute minimum of \(T\) on \([0,3]\text{.}\) We find that
\begin{equation*}
T'(x) = -\frac{1}{8} + \frac{1}{3} \cdot \frac{1}{2} \left(4+x^2\right)^{-\frac{1}{2}} (2x) = -\frac{1}{8} + \frac{x}{3\sqrt{4+x^2}}\text{.}
\end{equation*}
Note that since \(4+x^2\ge2\) for every value of \(x\text{,}\) \(T'\) is defined everywhere. Setting \(T'(x) = 0\) and solving for \(x\text{,}\) we have \(\frac{x}{3\sqrt{4+x^2}} = \frac{1}{8}\text{,}\) so \(8x = 3\sqrt{4+x^2}\text{.}\) Squaring both sides yields
\begin{equation*}
64x^2 = 9(4+x^2) = 36 + 9x^2\text{.}
\end{equation*}
Hence \(55x^2 = 36\text{,}\) so \(x = \sqrt{\frac{36}{55}} \approx 0.809\text{.}\) (We don’t consider the critical number \(x = -\sqrt{\frac{36}{55}}\) because this doesn’t lie in the relevant domain of \(T\text{.}\))
Finally, we evaluate \(T\) at the only critical number in the interval and at the interval’s endpoints. Doing so, we find \(T(0) = \frac{3}{8} + \frac{2}{3} \approx 1.0417\text{,}\) \(T(3) = \frac{\sqrt{13}}{3} \approx 1.202\text{,}\) and \(T\left(\sqrt{\frac{36}{55}}\right) = \frac{3}{8} + \frac{\sqrt{55}}{12} \approx 0.993\text{.}\) Thus the absolute minimum time the hiker can achieve is about \(0.993\) hours, which is attained by hiking about \(2.2\) km from \(P\) towards \(Q\) and then turning into the woods for the remainder of the trip.