In Search of a More Elegant Solution I was asked to determine the maximum and minimum value of $$f(x,y,z)=(3x+4y+5z^{2})e^{-x^{2}-y^{2}-z^{2}}$$ on $\mathbb{R}^{3}$. 
Now, I employed the usually strategy; in other words calculating the partial derivatives, setting each to zero, and the solve for $x,y,z$ before comparing the values of the stationary points. I obtained $$M=5e^{-3/4}$$ as the maximum value and $$m=(-5e^{-1/2})/{\sqrt{2}}$$ as the minimum value, both of which turned out to be correct. However, as I decided to solve for $x,y,z$ by the method of substitution, the calculations became somewhat hostile. 

I'm sure there must be a simpler way to arrive at the solutions, and I would be thrilled if someone here would be so generous as to share such a solution. 


Here's an ad-hoc approach. $f$ is the product of two functions $g$ and $h$:
$$g(x,y,z) = 3x+4y+5z^2 $$
$$h(x,y,z) = \exp(-x^2-y^2-z^2) = \exp(-r^2)$$
We can consider holding $r$ constant (so that $h$ is constant) and optimizing the value of $g$ over the corresponding sphere.
Solving, we get $z^2 = r^2 - x^2 - y^2$ with the constraint that $x^2 + y^2 \leq r^2$, and
$$g_r(x,y) = 3x + 4y + 5r^2 - x^2 - y^2$$
This is a more complex optimization problem, but with simpler formula which makes up for it. Which we can solve to obtain the minimum and maximum, respectively. As the formulas involve $r$, we get functions $m(r)$ and $M(r)$, respectively.
Then, the minimum of $f(x,y,z)$ has to occur at some value of $r$, and so it must be equal to the minimum of $m(r)$. Similarly, the maximum of $f(x,y,z)$ is the maximum of $M(r)$.
