The utility of a consumer is given by $U(x) = z(x,y(x))$, where
$$z(x,y) = x^2y^3 \quad \text{and} \quad y(x) = 10-x, \quad \text{with} \quad 0\leq x\leq10.$$
Determine all the values of $x$ such that the tangent line to the graph of $U(x)$ is horizontal.

The tangent line to the graph of a function is horizontal in a point if the derivative in that point is equal to zero. Hence, we have to find all $x$ such that
$$U'(x) = 0.$$
Firstly, we have to determine the derivative of $U(x)$. According to the chain rule (case 2)
$$U'(x) = z'_x(x,y(x)) + z'_y(x,y(x))y'(x).$$
Hence, we need the partial derivatives of $z(x,y)$ at $(x,y(x))$ and the derivative of $y(x)$:
$$
\begin{align}
z'_x(x,y) &= y^3 \cdot 2x = 2xy^3\\
z'_x(x,y(x)) &= 2x \cdot (10-x)^3 =2x(10-x)^3\\[2mm]
z'_y(x,y) &= x^2 \cdot 3y^2 = 3x^2y^2\\
z'_y(x,y(x)) &= 3x^2 \cdot (10-x)^2 = 3x^2(10-x)^2\\[2mm]
y'(x) &= -1.
\end{align}
$$
Now we find $U'(x)$ by plugging in the prescriptions of $z'_x(x,y(x))$, $z'_y(x,y(x))$ and $y'(x)$:
$$
\begin{align}
U'(x) &= 2x(10-x)^3 + 3x^2(10-x)^2 \cdot (-1) = 2x(10-x)^3 - 3x^2(10-x)^2 = x(10-x)^2(2(10-x)-3x) \\
&= x(10-x)^2(20-2x-3x) = x(10-x)^2(20-5x).
\end{align}
$$
Finally, we have to solve $U'(x)=0$:
$$
\begin{array}{ccccc}
{x(10-x)^2(20-5x) = 0}\\[1mm]
x = 0 &\quad \mbox{ or } \quad& (10-x)^2=0 &\quad \mbox{ or } \quad& 20-5x = 0\\[1mm]
&& 10-x = 0 && 20 = 5x\\[1mm]
&& x = 10 && x = 4
\end{array}
$$
Note that all three solutions satisfy $0\leq x \leq10$. Hence, there are three values of $x$ such that the tangent line to the graph of $U(x)$ is horizontal:
$$ x=0 \quad\mbox{ or }\quad x=4 \quad\mbox{ or }\quad x=10.$$