Composition of Even and Odd Functions and their Outcome

Give an example of an even function. Give an example of an odd function. If f(x) is odd and g(x) is even, must f(g(x)) be even? Must g(f(x)) be even?

I've tried generic functions like

f(x) = x^3 and g(x) = x^2

Both compositions (going f(g(x)) and g(f(x)) yield even results)

However, when I use the trig functions, something different happens.

f(x) = sin(x) g(x) = cos(x)

f(g(x)) = even

and

g(f(x)) = even.

Therefore, can I assume, that the combination of any function (that is not neither odd nor even) will be even?

Try doing this generically. Suppose first that $f$ is even and $g$ is odd. Then $$f(g(-x)) = f(-g(x)) = f(g(x))$$ where the first equality is because $g$ is odd and the second is because $f$ is even. Therefore $f\circ g$ is even. Do this for all four possible combinations and you'll see how things work.

Any time you compose real functions, if any of them are even and the rest are odd then the composition is even. This is because odd functions "retain" negation and even functions "get rid of" it. For example if $f$ is even and $g$ is odd,

$g(f(-x) = g(f(x))$ (even)

$f(g(-x) = f(-g(x)) = f(g(x))$ (even)

You can prove rules regarding composition of odd and even functions straight from the definitions. A function $f: \mathbb{R} \rightarrow \mathbb{R}$ is even if $f(-x)=f(x)$ for all $x$; it is odd if $f(-x)=-f(x)$ for all $x$. Now consider $f$ odd and $g$ even: $f\circ g(-x)=f(g(-x))=f(g(x)),$ since $g$ is even.

But, by definition, $f(g(x))=f\circ g(x)$, so $f \circ g$ is even.

A similar proof shows that $g \circ f$ is even.

It is certainly not true that the composition of any two functions will be even. Take $f$ defined by $f(x)=x+1$, and $g(x)=x+4$. Then $g\circ f(-x) = g(-x+4)=-x+5$, while $g \circ f(x)=x+5$.

As a notational aside, note that $f(x)$ is not a function, but rather the value of the function $f$ on a particular element $x$. A function from the real numbers to the real numbers is is a rule that assigns to each real number $x$ another number, which we write as $f(x)$. So it doesn't make sense to talk about the value $f(x)$ being odd or even -- being even and odd is a property of the rule, the function itself.

This is a common confusion, especially since it's common to refer to "the function $f(x)=x^2$" -- that is, to identify a function with a particular formula. It would be more precise to refer to "the $f: \mathbb{R} \rightarrow \mathbb{R}$ defined by $f(x)=x^2$ for all $x \in \mathbb{R}$," but as you can see it's more cumbersome.

I would continue trying to play with very simple functions so you can get a feel of what's going on before drawing general conclusions.

For example, you haven't tried the composition of two odd functions yet. Try $f(x)=g(x)=x$ and see what you get.

Also, you haven't tried the composition of two functions which are neither odd nor even. Try $f(x)=g(x)=x-1$.

After you fiddle around with some simple cases and understand them, see if you can develop a general rule.