<s>[INST] Finding all the minima and maxima within a range I'm not sure how to find all the maximas and minimas where the range is $1≤x≤18$ and the function is: $$20\sin \left(\fracπ6x-\frac {2\pi}3\right)+22$$ I already found the first derivative which is: $$\frac{10\pi}3\cos\left(\frac{\pi}{6}x-\frac{2\pi}{3}\right)=0$$ where $x$ is $7$ and using $f''(x)$ and subbing in my $x$, I get $-5.48$ which is a maximum.
 [/INST] To simplify the problem, put $u = \dfrac{\pi}{6}x-\dfrac{2\pi}{3}$, then you have a much better function to deal with: $f(u) = 20\sin u + 22, -\dfrac{\pi}{2} \le u \le \dfrac{7\pi}{3}$. Since $-1 \le \sin u \le 1$, so $2 \le f(u) \le 42$, and the min and max are $2, 42$ respectively. The min occurs when $u = -\dfrac{\pi}{2} \implies \dfrac{\pi}{6}x - \dfrac{2\pi}{3} = -\dfrac{\pi}{2} \implies x = 1$, and the max occurs when $ u = \dfrac{\pi}{2} \implies \dfrac{\pi}{6}x - \dfrac{2\pi}{3} = \dfrac{\pi}{2} \implies x = 7$.
</s>