Representing a real valued function as a sum of odd and even functions [duplicate]

With $f(x)$ being a real valued function we can write it as a sum of an odd function $m(x)$ and an even function $n(x)$: $f(x)=m(x)+n(x)$

Write an equation for $f(-x)$ in terms of $m(x)$ and $n(x)$:

My attempt using the properties - even function if: $f(x)=f(-x)$ and odd function if: $-f(x)=f(-x)$

$f(x)=m(x)+n(x) \implies f(-x)=m(-x)+n(-x) \implies f(-x)= -m(x)+n(x) \implies f(-x)=n(x)-m(x)$

I think that is correct but then I need to find equations for both $m(x)$ and $n(x)$ in terms of $f(x)$ and $f(-x)$ so a suggestion on how to tackle that would be great.


Solution 1:

$$f(x)=\frac{1}{2}\left(f(x)+f(-x)\right)+\frac{1}{2}\left(f(x)-f(-x)\right)$$

Solution 2:

Add and subtract $f(x) = m(x) + n(x)$ and $f(-x)=n(x)-m(x)$.