Find the maximum of a sum Given $x + y + z = 0, x + 1 > 0, y + 1 > 0, z + 4 > 0$, find the maximum of $$Q=\frac{x}{x+1} + \frac{y}{y+1} + \frac{z}{z+4}$$
The answer is $\frac{1}{3}$
I've tried inverting each of the fractions then using AM-GM on them, but it doesn't give me the correct answer
 A: With $u:=x+1,v:=y+1$,
$$Q=\frac{u-1}u+\frac{v-1}v+\frac{2-u-v}{6-u-v}=1-\frac1u+1-\frac1v+1-\frac4{6-u-v}.$$
Then we have stationary points where
$$Q'_u=\frac1{u^2}-\frac4{(6-u-v)^2}=Q'_v=\frac1{v^2}-\frac4{(6-u-v)^2}=0,$$
giving
$$u=v=\frac32$$ and $$Q=\dfrac13.$$
Note that if we saturate one of the constraints, the function $Q$ tends to $-\infty$ and the maximum is indeed inside.
A: First set


*

*$a=x+1, b=y+1, c= z+4 \Rightarrow a,b,c >0$ and $a+b+c = 6$
Hence, to maximize is 
$$Q = 3-\left(\frac 1a + \frac 1b + \frac 4c \right)$$
So, minimize 
$$\left(\frac 1a + \frac 1b + \frac 4c \right) = \frac{a+b+c}6\left(\frac 1a + \frac 1b + \frac 4c\right)$$
$$= \frac 16+\frac 16 + \frac 23 + \frac 16\left(\frac{b+c}{a} + \frac{a+c}{b} + 4\frac{a+b}{c}\right)$$
$$=1 + \frac 16\left( \frac ba+\frac ab + \frac ca + 4 \frac ac + \frac cb + 4 \frac bc\right)$$
$$\stackrel{3\times AM-GM}{\geq} 1 + \frac 16\left( 2+ 4 + 4 \right)= \frac 83 $$
with equality if $\frac ab= 1$ and $\frac ca = \frac cb = 2$. With $a+b+c = 6$ it follows the minimum is achieved for $c=3, a = b=\frac 32$.
So, maximum of $Q$ is $3-\frac 83 = \boxed{\frac 13}$
A: By C-S
$$\frac{x}{x+1}+\frac{y}{y+1}+\frac{z}{z+4}=3+\frac{x}{x+1}-1+\frac{y}{y+1}-1+\frac{z}{z+4}-1=$$
$$=3-\left(\frac{1}{x+1}+\frac{1}{y+1}+\frac{4}{z+4}\right)=$$
$$=3-\frac{1}{6}(x+1+y+1+z+4)\left(\frac{1}{x+1}+\frac{1}{y+1}+\frac{4}{z+4}\right)\leq$$
$$\leq3-\frac{1}{6}(1+1+2)^2=\frac{1}{3}.$$
The equality occurs for $$(x+1,y+1,z+4)||(1,1,2)$$ or for
$$(x,y,z)=\left(\frac{1}{2},\frac{1}{2},-1\right),$$ which says that we got a maximal value.
