How to find the maximum value of $\frac{2\sin\theta\cos\theta}{(1+\cos\theta)(1+\sin\theta)}$? Let $\theta\in\left(0,\frac{\pi}{2}\right)$, then find the maximum value of $\dfrac{2\sin\theta\cos\theta}{(1+\cos\theta)(1+\sin\theta)}$
I found the derivative, which is equal to $\dfrac{(\cos\theta−\sin\theta)(\sin\theta+\cos\theta+1)^2}{(1+\sin\theta+\cos\theta+\sin\theta\cos\theta)^2}$
But there were complicated calculations involved. Is there a simpler way to find the maximum of this function?
 A: Change the variable:
$t=\tan{\frac{\theta}{2}}; t\in (0,1)$
$\tan{\frac{\theta}{2}}$ is one to one in this interval.
$\sin{\theta}=\frac{2t}{1+t^2}$
$\cos{\theta}=\frac{1-t^2}{1+t^2}$=>
$$f(\theta)=g(t)=2\frac{\frac{2t}{1+t^2}\frac{1-t^2}{1+t^2}}{\left(1+\frac{2t}{1+t^2}\right)\left(1+\frac{1-t^2}{1+t^2}\right)}=2t\frac{1-t}{1+t}$$
Now is easy to find the maximum!
A: 
Step 1: Find the critical points of $f(\theta)$:

For this, it is necessary to find the derivative of the function and do $f'(\theta)=0$, such that:
\begin{align*}
    f'(\theta)=&-\dfrac{2\cos^2\theta\sin\theta}{(cos\theta+1)(\sin\theta+1)^2} +\\
               &+\dfrac{2\cos^2\theta}{(\cos\theta+1)(sin\theta+1)}+ \\
               &+\dfrac{2\cos\theta\sin^2\theta}{(\cos\theta+1)^2(\sin\theta+1)} -\\
               &-\dfrac{2\sin^2\theta}{(\cos\theta+1)(\sin\theta+1)}=0
\end{align*}
We can rewrite this:
\begin{equation}
     f'(x)=\dfrac{2(\cos\theta-\sin\theta)(\cos\theta+\cos^2\theta+\sin\theta+\cos\theta\sin\theta+\sin^2\theta)}{(\cos\theta+1)^2(\sin\theta+1)^2}=0
\end{equation}
dividing by 2 both sides and reduce trigonometric functions:
\begin{equation}
     \dfrac{3\cos\theta+4\cos(2\theta)+\cos(3\theta)-3\sin\theta +\sin(3\theta)}{4(\cos\theta+1)^2(\sin\theta+1)^2}=0
\end{equation}
multiplying both sides by 4 and assuming $(\cos\theta+1)\neq 0$ and $(\sin\theta+1)\neq 0$, we can treat the problem in another way, such that:
\begin{equation}
     3\cos\theta+4\cos(2\theta)+\cos(3\theta)-3\sin\theta +\sin(3\theta)=0
\end{equation}
Show that this equation is equal to:
\begin{equation}
     16\sqrt{2}\cos^2\left(\dfrac{\theta}{2}\right)\sin\left(-\theta+\dfrac{\pi}{4}\right)\sin^2\left( \dfrac{\theta}{2}+\dfrac{\pi}{4} \right)
\end{equation}
This implies that:
\begin{equation}
     \cos^2\left(\dfrac{\theta}{2}\right)\sin\left(-\theta+\dfrac{\pi}{4}\right)\sin^2\left( \dfrac{\theta}{2}+\dfrac{\pi}{4} \right)=0
\end{equation}
We have 3 possibilities:
\begin{align}
      \cos^2\left(\dfrac{\theta}{2}\right)&=0 \\
      \sin\left(-\theta+\dfrac{\pi}{4}\right)&=0 \\
      \sin^2\left( \dfrac{\theta}{2}+\dfrac{\pi}{4} \right)&=0
\end{align}
Solving this 3 equations, you find that:
$$\theta=\dfrac{\pi}{4}$$

Step 2: Determine the endpoints of the domain of $f(\theta)$

For $\theta=0^+$ and $\theta=\dfrac{\pi}{2}^{-}$, we have $f(\theta)=0$, this implies:
$$\fbox{$f\left(\dfrac{\pi}{4}\right)=6-4\sqrt{2}$}$$
Is the global maximum of $f(\theta)$.
A: Let $$f(\theta)=\frac{2\sin\theta\cos\theta}{(\sin\theta+1)(\cos\theta+1)}=\frac{2\sin\theta\cos\theta}{1+\sin\theta+\cos\theta+\sin\theta\cos\theta}$$
Taking $\sin2\theta=t,\ t\in(0,1],$ $$f(t)=\frac t{1+\sqrt{1+t}+\frac t2}=\frac{2t}{2+2\sqrt{1+t}+t}=\frac2{\left(\frac 1t+\sqrt{\frac 1t+1}\right)^2}$$
In order to maximize the given function in the question one needs to find the minimum value of the denominator of the expression after the manipulations done in the image. The minimum value of denominator will be obtained at t=1 and it's easy to see that. Putting t=1 gives the maximum value of function to be $6-4\sqrt2$.
A: The first derivative is:
$\frac{2\sqrt{2}cos(\theta+\frac{\pi}{4})}{(1+\cos\theta)(1+\sin\theta)}$,
which becomes null in:
$\theta=\frac{5\pi}{4}$, $\theta=\frac{-3\pi}{4}$, $\theta=\frac{\pi}{4}$.
The maximum is for
$\theta=\frac{\pi}{4}$ and,
and is equal to $-4\sqrt{2}+6$.
