What is the decomposition into even and odd function of a function equal to $x$ when $x \geq 0$ and equal to zero when $x <0$? Every function $f$ with domain in $\mathbb{R}$ can be written
$$f=E+O$$
where $E$ is an even function and $O$ is an odd function.
Proof
Assume $f(x) = E(x) + O(x)$.
Then
$$f(-x)=E(-x) + O(-x)=E(x)-O(x)$$
Therefore, given a function $f$,
$$f(x) = E(x) + O(x)$$
$$f(-x)=E(x)-O(x)$$
represent a system of two equations in two unknowns.
We can solve for
$$E(x) = \frac{f(x) + f(-x)}{2}$$
$$O(x) = \frac{f(x) - f(-x)}{2}$$
This concludes the proof.
Now consider a function
$$f(x) = \begin{cases} 0\text{ if } x < 0 \\ 
x\text{ if } x \geq 0
\end{cases}$$
What do $E(x)$ and $O(x)$ look like?
$$E(x) = \begin{cases} \frac{0+x}{2}=\frac{x}{2}\text{ if } x<0 \\
\frac{x+0}{2}=\frac{x}{2}\text{ if } x \geq 0
\end{cases}$$
Isn't the function $E(x)=\frac{x}{2}$ odd?
Similarly, we reach
$$O(x) = \begin{cases} \frac{0-x}{2}=-\frac{x}{2}\text{ if } x<0 \\
\frac{x-0}{2}=\frac{x}{2}\text{ if } x \geq 0
\end{cases}$$
Isn't $O(x)$ even?
I must be missing something very silly here.
 A: 
True, I felt a bit weird about it too. I should have made the proof something like as follows. Let $f$ be any function. Let $E(x)=\frac{f(x)+f(-x)}{2}$ and let $O(x)=\frac{f(x)-f(-x)}{2}$. Then, I easily show that $E$ is even, $O$ is odd, and $f=E+O$. Thus we can say $f=E+O$ with $E$ even and $O$ odd, for any function $f$.

Yes, exactly. You'd originally (in the Question) proved the required theorem's converse instead. These two parts together show that every function has a unique decomposition into a pair of even and odd functions.

$$E(x) = \begin{cases} \frac{0+x}{2}=\frac{x}{2}\text{ if } x<0 \\
\frac{x+0}{2}=\frac{x}{2}\text{ if } x \geq 0
\end{cases}$$ Isn't the function $E(x)=\frac{x}{2}$ odd?

Correction: $$E(x) = \begin{cases} \frac{0+(-x)}{2}=-\frac{x}{2}\text{ if } x<0 \\
\frac{x+0}{2}=\frac{x}{2}\text{ if } x \geq 0
\end{cases}.$$

$$O(x) = \begin{cases} \frac{0-x}{2}=-\frac{x}{2}\text{ if } x<0 \\
\frac{x-0}{2}=\frac{x}{2}\text{ if } x \geq 0
\end{cases}$$

Correction: $$O(x) = \begin{cases} \frac{0-(-x)}{2}=\frac{x}{2}\text{ if } x<0 \\
\frac{x-0}{2}=\frac{x}{2}\text{ if } x \geq 0
\end{cases}.$$
