Hello, Rimas!
A rectangle $\displaystyle PQRS$ is inscribed as sketched in the region between the [tex]x[/mathy]axis
and the part of the graph $\displaystyle y\:=\:\cos(4x)$, on $\displaystyle [8\pi,\,8\pi]$
Determine the coordinates of $\displaystyle P$ for which the perimeter of $\displaystyle PQRS$ is a maximum. Code:

*
*  *
*      *
*    *
* y  y *
  
*+++*
8π x  x 8π
The perimeter of the rectangle is: .$\displaystyle P \:=\:4x + 2y$ .where $\displaystyle y \:=\:\cos(4x)$
So we have: .$\displaystyle P \:=\:4x + 2\cos(4x)$
Set the derivative equal to zero: .$\displaystyle P\:\!' \:=\:4  8\sin(4x) \:=\:0 \quad\Rightarrow\quad \sin(4x) \,=\,\frac{1}{2}$
. . Hence: .$\displaystyle 4x \:=\:\frac{\pi}{6} \quad\Rightarrow\quad x \:=\:\frac{\pi}{24}$
. . Then: .$\displaystyle y \:=\:\cos\left(4\cdot\frac{\pi}{24}\right) \:=\:\cos\left(\frac{\pi}{6}\right) \:=\:\frac{\sqrt{3}}{2}$
Therefore: .$\displaystyle P\left(\frac{\pi}{24},\:\frac{\sqrt{3}}{2}\right) $