Show that every polynomial is the sum of an even and odd function. [duplicate]

This question already has an answer here:

I have been given an optional challenge problem at the end of one of my earlier tutorials that I am unsure how to solve. It is a question with three parts, but I would like to tackle them separately with a little help on part a.

a function $f$ is even if $f(-x) = f(x)$ for all $x$, and odd if $f(-x) = -f(x)$ for all $x$.

Now I am told to show that every polynomial is the sum of both an even and an odd function, but have no idea how to go about this.

Is the key to this question that $f(-x) = x^2$ will always $= f(x)$ $\therefore$ $x^2$ is even? I understand that, and if a secondary function was $g(-x) = x$, where x is only positive, then it would make sense that this is a odd function, but it is for all x, and therefore a negative x value in g(-x) would become positive and it wouldn't be an odd or an even function.

-

marked as duplicate by Marc van Leeuwen, Daniel Fischer♦, azimut, Dominic Michaelis, mauOct 14 '13 at 7:34

Not just polynomials but rather every function can be written as a sum of an even and an odd function. – Fixed Point Oct 14 '13 at 5:10
@Display Name:- Not only for polynomials but every function can be written as "the sum of both an even and an odd function" indeed $f(x)=\frac{f(x)+f(-x)}2 + \frac {f(x)-f(-x)}2$ – Souvik Dey Oct 14 '13 at 5:10
DisplayName: You must be able to understand the formula in the comment by @SouvikDey, why it is true, and why its terms are even respectively odd. If this is still too advanced for you, then I am afraid that you cannot understand the question, so there is no point asking for an answer. – Marc van Leeuwen Oct 14 '13 at 5:19
@Marc van Leeuwen: Thank you , but I don't think I need to post it as an answer any more , there are lots of nice answers already posted and Secret Math's answer follows the same line as that of mine. – Souvik Dey Oct 14 '13 at 5:31

Hint: $x$, $x^3$, $x^5$, ... are all odd, while $1$, $x^2$, $x^4$, ... are all even (prove this!). So try decomposing a polynomial into a sum of terms only involving even powers of $x$, and terms only involving odd powers of $x$.

-

Think about the easiest even (or odd) functions. The first one I will think of is $f(x) = x$ and $f(x) = x^2$. Next you will realize that for $f(x) = x^n$ it is even or odd depending on if $n$ is even or odd. (That also helps you to understand why they are called even (or odd) functions.)

Now that we are only looking at polynomials, we can naturally divide a polynomials into odd and even degrees. The rest would be easy.

A more general construction works for any functions: $\frac{f(x) + f(-x)}{2}$ is always even, and $\frac{f(x) - f(-x)}{2}$ is always odd, and they add up to $f(x)$.

-
Well you got the idea from other people's comment. – Secret Math Oct 14 '13 at 5:13

I think T. Bongers's answer is the most natural way to solve this problem, seeing as your given function is a polynomial. Here is an alternative method. You have a given function $P(x)$ which you want to express as the sum of an odd function, call it $D(x)$, and an even function, call it $E(x)$. So $P(x),D(x),E(x)$ satisfy the identity $P(x)=D(x)+E(x)$. That's one equation in two unknowns, $D(x)$ and $E(x)$. Now, substituting $-x$ for $x$ in the identity $P(x)=D(x)+E(x)$, you get another identity, $P(-x)=D(-x)+E(-x)=-D(x)+E(x)$. So now you have two equations in two unknowns: $D(x)+E(x)=P(x)$ and $-D(x)+E(x)=P(-x)$. Solving this system of equations, you get formulas for $D(x)$ and $E(x)$ in terms of $P(x)$ and $P(-x)$. You can then verify that $D(x)$ and $E(x)$ are indeed odd and even respectively, and that (assuming $P(x)$ is a polynomial, or even an infinite series in powers of $x$) they are the same functions that T. Bongers hinted at in his answer.

-