If for all $\displaystyle \theta \in [ 0,\frac{\pi}{2} ]$, we have $ | \sin \theta - p \cos \theta - q|\leq \frac{\sqrt{2}-1}{2}$. Then find $p+q$. 
If for all $\displaystyle \theta \in [ 0,\frac{\pi}{2} ]$, we have $ | \sin \theta - p \cos \theta - q|\leq \frac{\sqrt{2}-1}{2}$. Find $p+q$.


My Work: When $p=-1,q=\frac{\sqrt{2}+1}{2}$, we have 
$$ \sin \theta -p\cos\theta-q\\=\sqrt{2}\sin(\theta+\frac{\pi}{4})-\frac{\sqrt{2}+1}{2}$$
which fit the condition.
But I couldn't find other $p$ and $q$ or couldn't prove the uniqueness.
 A: We want to find the image of $f(\theta)=\sin\theta - p\cos\theta = \sqrt{1+p^2}\sin(\theta-\tan^{-1}p)$. The inequality can be satisfied only if $\max f-\min f \le \sqrt2-1$ in $\theta\in[0,\frac12\pi]$. Then we could choose $q$ around $\frac12(\max+\min)$ to fit in.
Note that $f(0)=-p$ and $f(\frac12\pi)=1$, and $\sqrt2-1=0.414\dots<1$.
We separate into 3 cases:


*

*$-\frac12\pi<-\tan^{-1}p\le 0 \iff p\ge0$, where $f$ is strictly increasing in its domain,

*$0<-\tan^{-1}p<\frac12\pi\iff p<0$, where $f$ is strictly concave (↗↘), which we further split into 2 sub-cases:
(a) $-1< p<0$, where $f(0)< f(\frac12\pi)$, and
(b) $p\le-1$, where $f(0)\ge f(\frac12\pi)$.
In case 1, the min is $f(0)=-p$ and the max is $f(\frac12\pi)=1$, so we need $1+p\le\sqrt2 - 1$ which is impossible as $p>0$.
In case 2, the max is attained when $\theta-\tan^{-1}p=\frac12\pi$ i.e. $\max f=\sqrt{1+p^2}$, and the min is either (a) $f(0)=-p$ or (b) $f(\frac12\pi)=1$. Let $P=-p>0$. Then we need to solve these inequalities:
\begin{gather}
\sqrt{1+P^2}-P \le \sqrt2 - 1,\tag{a} \\
\sqrt{1+P^2}-1 \le \sqrt2 - 1 \tag{b}
\end{gather}
The solution to (a) is $P\ge1$ and that to (b) is $|P|\le 1$. Together with the ranges of $p$ in (a) and (b) we know that $p=-1$ is the only solution.
