$f(x) = \cos|x| - 2ax + b$ increases for all $x$. Find the maximum value of $2a + 1$ Here's how I approached the problem.
$f'(x) = -\sin x - 2a$
$f'(x) \geq 0$
$\Rightarrow -\sin x -2a \geq 0$
$\Rightarrow 2a \leq -\sin x$
$\Rightarrow 2a+1 \leq 1- \sin x  \tag{*}$
Since range of $\sin x$ is $[-1,1]$,
$\Rightarrow 2a+1\leq 1-(-1)$
$\Rightarrow 2a+1\leq 2$
Hence maximum value of $2a+1$ is coming to be $2$. However the answer to the question is $0$. What am I doing wrong?
 A: After taking the derivative you want $f'(x) \ge 0$ for all $x$.
This means you want
$$\sin(x) \le -2a$$
for all $x$
Now... for this to be true for all $x$, you must have:
$$-2a \ge 1$$
i.e. $a \le -0.5$
So the max value of $2a+1$ is $2\cdot(-0.5) + 1 = 0$

So... up to line $(*)$ everything is OK in your solution. But at that
line you need to ask yourself: what can I put for $(2a+1)$ for this
$(*)$ to be always true. And the answer is you need $(2a+1) \le 0$
because the range of $$g(x) = 1 - \sin(x)$$ is $[0,2]$.

A: $-1\leq \sin x \leq 1\implies -1\leq-\sin x \leq 1 \implies 0\leq 1-\sin x \leq 2$. Note too that $1-\sin x$ assumes all values in $[0,2]$.
If you require that $2a+1\leq 1-\sin x$ for all $x$, then $2a+1\leq0$.
If you choose any greater value of $a$, there will be values of $x$ for which $2a+1>1-\sin x$.
The critical observation here is that you require this to be true for all $x$, and since $1-\sin x$ assumes all values in $[0,2]$, you must have that $2a+1$ is required to avoid that interval.
A: We must have
$$(\forall x\in \Bbb R) \;\; 2a+1\le 1-\sin(x)$$
So
$$2a+1\le \inf\{1-\sin(x),\;x\in \Bbb R\}$$
$$\implies 2a+1\le 0$$
$$\implies \max (2a+1)=0$$
