find $f\in L^2([0,\pi])$ such that its $L^2$ distance to $\sin(x)$ and $\cos(x)$ are both bounded by specific constants I want to find all $f\in L^2([0,\pi])$ such that
$$
\begin{align}
\int_0^\pi\lvert f(x)-\sin(x)\rvert^2\,dx &\le \frac{4\pi}{9}\\
\int_0^\pi\lvert f(x)-\cos(x)\rvert^2\,dx &\le \frac{\pi}{9}\\
\end{align}
$$
I started by taking the Fourier transform of $\sin(x)$ and $\cos(x)$, and then used Parseval's theorem. This led to
$$
\begin{align}
\frac{4\pi}{9} \ge \lvert\lvert \,f(x) - \sin(x) \rvert\rvert_{L^2} &= \left|\left|\, \hat{f}(\kappa) - \frac{1+e^{-2\pi i \kappa}}{(1-4\kappa^2)\sqrt{\pi}} \right|\right|_{\ell^2}\\
\frac{\pi}{9} \ge \lvert\lvert \,f(x) - \cos(x) \rvert\rvert_{L^2} &= \left|\left|\, \hat{f}(\kappa) - \frac{2i\kappa(1+e^{-2\pi i \kappa})}{(1-4\kappa^2)\sqrt{\pi}} \right|\right|_{\ell^2}
\end{align}
$$
Maybe that was going down the wrong path, but that's where I'm at now. I don't see what to do next, or have any other ideas.
Any thoughts? Thanks.
 A: If $f(x)$ is real-valued, take $\dfrac{1}{3}$ times the first inequality plus $\dfrac{2}{3}$ times the second inequality to get:
$$\int_{0}^{\pi}\dfrac{1}{3}(f(x)-\sin x)^2+\dfrac{2}{3}(f(x)-\cos x)^2\,dx \le \dfrac{1}{3} \cdot \dfrac{4\pi}{9} + \dfrac{2}{3}\cdot\dfrac{\pi}{9}$$
$$\int_{0}^{\pi}\left[f(x)^2-2f(x)\left(\dfrac{1}{3}\sin x - \dfrac{2}{3}\cos x\right) + \dfrac{1}{3}\sin^2 x + \dfrac{2}{3}\cos^2 x\right]\,dx \le \dfrac{2\pi}{9}$$
By completing the square and simplifying, this becomes:
$$\int_{0}^{\pi}\left[\left(f(x)-\dfrac{1}{3}\sin x - \dfrac{2}{3}\cos x\right)^2 + \dfrac{1}{3}\sin^2 x + \dfrac{2}{3}\cos^2 x - \left(\dfrac{1}{3}\sin x + \dfrac{2}{3}\cos x\right)^2\right]\,dx \le \dfrac{2\pi}{9}$$
$$\int_{0}^{\pi}\left[\left(f(x)-\dfrac{1}{3}\sin x - \dfrac{2}{3}\cos x\right)^2 + \dfrac{2}{9}\sin^2 x - \dfrac{4}{9}\sin x \cos x + \dfrac{2}{9}\cos^2 x\right]\,dx \le \dfrac{2\pi}{9}$$
$$\int_{0}^{\pi}\left[\left(f(x)-\dfrac{1}{3}\sin x - \dfrac{2}{3}\cos x\right)^2 + \dfrac{2}{9} - \dfrac{2}{9}\sin 2x \right]\,dx \le \dfrac{2\pi}{9}$$
$$\int_{0}^{\pi}\left(f(x)-\dfrac{1}{3}\sin x - \dfrac{2}{3}\cos x\right)^2\,dx + \dfrac{2\pi}{9}\le \dfrac{2\pi}{9}$$
$$\int_{0}^{\pi}\left(f(x)-\dfrac{1}{3}\sin x - \dfrac{2}{3}\cos x\right)^2\,dx \le 0.$$
This is only possible if $f(x) = \dfrac{1}{3}\sin x + \dfrac{2}{3}\cos x$ almost everywhere on $[0,\pi]$.
Note: If $f(x)$ is complex-valued, then split it into the sum of its real and imaginary parts ($f(x) = f_r(x)+if_i(x)$) and repeat the above algebra. There will be an extra $\int_{0}^{\pi}f_i(x)^2\,dx$ term on the left side, but the conclusion will still be the same. 
A: First, note that
\begin{align}
   \|\sin-\cos\|^2&=\|\sin(x)\|^2+2\langle\sin,\cos\rangle+\|\cos\|^2 \\
   & =\|\sin\|^2+\|\cos\|^2 \\
   & = \|1\|^2=\pi.
\end{align}
You want
$$
       \|f-\sin\|+\|f-\cos\| \le \frac{2}{3}\sqrt{\pi}+\frac{1}{3}\sqrt{\pi}=\sqrt{\pi}
$$
If you have the above, then
$$
      \sqrt{\pi}=\|\sin-\cos\| \le \|\sin-f\|+\|f-\cos\| \le \sqrt{\pi}.
$$
The only way that happens is if $f$ lines on the segment connecting $\sin$ and $\cos$. That means there is a real scalar $\alpha$ such that $0 \le \alpha \le 1$ and
$$
                f = \alpha\sin +(1-\alpha)\cos.
$$
The $\alpha$ is unique because
\begin{align}
       \|f-\sin\|=\frac{2}{3}\sqrt{\pi},&\;\;\; \|f-\cos\|=\frac{1}{3}\sqrt{\pi} \\
     \|(\alpha-1)\sin+(1-\alpha)\cos\|=\frac{2}{3}\sqrt{\pi},
    &\;\;\; \|\alpha(\sin-\cos)\|=\frac{1}{3}\sqrt{\pi} \\
      (1-\alpha)\|\sin-\cos\|=\frac{2}{3}\sqrt{\pi}, &\;\;\;
      \alpha\|\sin-\cos\|=\frac{1}{3}\sqrt{\pi} \\
      (1-\alpha)=\frac{2}{3},&\;\;\; \alpha=\frac{1}{3}.
\end{align}
So that works out to give the solution
$$
          f = \frac{1}{3}\{\sin+2\cos\}
$$
A: You have two points ($\sin x$ and $\cos x$) in your space ($L^2$).
You take a ball about each point and try to find a point in the intersection of the two balls. 
If there are any such points, there will be one that is a convex linear combination of sin and cos ($t\sin x +(1-t)\cos x$). This reduces it to looking for a single number between 0 and 1. 
Now you could probably guess the number by drawing the picture in $\mathbb{R}^2$ or else plug in a convex linear combination and "solve" the inequalities.
