TExcelTAD
Home › Calculus Essentials › Even and Odd Functions

Even and Odd Functions

Some functions are mirror images of themselves, and that symmetry can make an integral half the work, or no work at all. This lesson shows how to recognise even and odd functions and how to use them on symmetric intervals like [−a,a][-a, a].

Definitions

Type Rule Graph Examples
Even f(−x)=f(x)f(-x) = f(x) mirror symmetric about the y-axis x2x^2, x4x^4, cos⁡x\cos x, ∣x∣\lvert x \rvert, e−x2e^{-x^2}
Odd f(−x)=−f(x)f(-x) = -f(x) symmetric under a half-turn about the origin xx, x3x^3, sin⁡x\sin x, tan⁡x\tan x, xcos⁡xx \cos x
Neither none of the above exe^x, x+1x + 1, x2+xx^2 + x

For polynomials the names fit: only even powers means even, only odd powers means odd. A constant term counts as an even power (x0x^0).

Products follow sign-like rules, with even as ++ and odd as −-:

even×even=evenodd×odd=eveneven×odd=odd\text{even} \times \text{even} = \text{even} \qquad \text{odd} \times \text{odd} = \text{even} \qquad \text{even} \times \text{odd} = \text{odd}

So xsin⁡xx \sin x (odd×odd\text{odd} \times \text{odd}) is even, and x2sin⁡xx^2 \sin x (even×odd\text{even} \times \text{odd}) is odd.

The integration shortcuts

On an interval symmetric around 0:

f even:∫−aaf(x) dx=2∫0af(x) dxf odd:∫−aaf(x) dx=0\begin{aligned} f \text{ even:}\quad \int_{-a}^{a} f(x)\,dx &= 2 \int_0^a f(x)\,dx \\ f \text{ odd:}\quad \int_{-a}^{a} f(x)\,dx &= 0 \end{aligned}

For an odd function the area on the left is the same size as the area on the right but has the opposite sign, so they cancel. For an even function both halves are equal, so compute one and double it.

∫−22(x4−3x2) dx=2∫02(x4−3x2) dx=2(32/5−8)=−16/5∫−ππx3cos⁡x dx=0(odd×even=odd)\begin{aligned} \int_{-2}^{2} (x^4 - 3x^2)\,dx &= 2 \int_0^2 (x^4 - 3x^2)\,dx = 2 (32/5 - 8) = -16/5 \\ \int_{-\pi}^{\pi} x^3 \cos x\,dx &= 0 && (\text{odd} \times \text{even} = \text{odd}) \end{aligned}
python · try it yourself
import sympy as sp

x = sp.symbols("x")

def kind(f):
    if sp.simplify(f.subs(x, -x) - f) == 0:
        return "even"
    if sp.simplify(f.subs(x, -x) + f) == 0:
        return "odd"
    return "neither"

for f in [x**4 - 3 * x**2, x**3 * sp.cos(x), x * sp.sin(x), sp.exp(x)]:
    print(f"{str(f):16} {kind(f):8}")

print(sp.integrate(x**4 - 3 * x**2, (x, -2, 2)), "=", 2 * sp.integrate(x**4 - 3 * x**2, (x, 0, 2)))
print(sp.integrate(x**3 * sp.cos(x), (x, -sp.pi, sp.pi)))
x**4 - 3*x**2    even
x**3*cos(x)      odd
x*sin(x)         even
exp(x)           neither
-16/5 = -16/5
0

Note: The shortcuts only work on intervals symmetric about zero. ∫02x3 dx=4\int_0^2 x^3\,dx = 4, not 0.

Every function splits into even + odd

Any function can be written as an even part plus an odd part:

feven(x)=f(x)+f(−x)2fodd(x)=f(x)−f(−x)2f_{\text{even}}(x) = \frac{f(x) + f(-x)}{2} \qquad f_{\text{odd}}(x) = \frac{f(x) - f(-x)}{2}

For exe^x these are cosh⁡x\cosh x and sinh⁡x\sinh x. On [−a,a][-a, a] only the even part contributes to the integral.

python · try it yourself
import sympy as sp

x = sp.symbols("x")
f = sp.exp(x)
even = (f + f.subs(x, -x)) / 2
odd = (f - f.subs(x, -x)) / 2
print("even part = cosh x ?", sp.simplify(even - sp.cosh(x)) == 0)
print("odd part  = sinh x ?", sp.simplify(odd - sp.sinh(x)) == 0)
print("∫_-1^1 e^x dx      =", sp.integrate(f, (x, -1, 1)))
print("2∫_0^1 cosh x dx   =", sp.simplify(2 * sp.integrate(sp.cosh(x), (x, 0, 1))).rewrite(sp.exp))
even part = cosh x ? True
odd part  = sinh x ? True
∫_-1^1 e^x dx      = E - exp(-1)
2∫_0^1 cosh x dx   = E - exp(-1)

SymPy prints E for the number ee, so both lines say e−1/e≈2.3504e - 1/e \approx 2.3504.

In software

  • Fourier analysis and audio: a signal splits into cosine (even) and sine (odd) parts. Many of the integrals that compute Fourier coefficients vanish by symmetry, for example ∫−ππsin⁡(mx)cos⁡(nx) dx=0\int_{-\pi}^{\pi} \sin(mx)\cos(nx)\,dx = 0 for all whole numbers m,nm, n, because the integrand is odd. This is why sine and cosine components can be measured separately.
  • Statistics: the standard normal density is even, so its mean ∫x p(x) dx\int x\,p(x)\,dx is zero (odd integrand) and P(Z≤0)=0.5P(Z \le 0) = 0.5.
  • Numerical code: integrating an even function over [−a,a][-a, a] with half the samples on [0,a][0, a] halves the cost. For an odd function, a numerical result that is not tiny reveals a bug or rounding error.
  • Graphics: mirror-symmetric meshes and kernels (blur filters are even) let code store and compute only half.
python · try it yourself
import numpy as np
from scipy.integrate import quad

odd = lambda x: x**3 * np.cos(x)
val, err = quad(odd, -np.pi, np.pi)
print(f"numerical ∫ odd = {val:.1e}")

m, n = 3, 5
val, _ = quad(lambda x: np.sin(m * x) * np.cos(n * x), -np.pi, np.pi)
print(f"∫ sin(3x)cos(5x) = {abs(val):.1e}")
numerical ∫ odd = 0.0e+00
∫ sin(3x)cos(5x) = 0.0e+00

Exercises

Exercise 1: Classify

Is each function even, odd, or neither? a) x5−2xx^5 - 2x, b) x2cos⁡xx^2 \cos x, c) x3+1x^3 + 1, d) sin⁡2x\sin^2 x.

Answer

a) odd, b) even, c) neither, d) even.

Solution
a) only odd powers→oddb) even×even→evenc) odd power plus constant (even)→neitherd) sin⁡x⋅sin⁡x=odd×odd→even\begin{aligned} &\text{a) only odd powers} && \to \text{odd} \\ &\text{b) even} \times \text{even} && \to \text{even} \\ &\text{c) odd power plus constant (even)} && \to \text{neither} \\ &\text{d) } \sin x \cdot \sin x = \text{odd} \times \text{odd} && \to \text{even} \end{aligned}

Exercise 2: Zero without integrating

Evaluate ∫−33(x5−4x3+x) dx\int_{-3}^{3} (x^5 - 4x^3 + x)\,dx.

Answer

0

Solution

Every term is an odd power, so the integrand is odd and the interval is symmetric. The integral is 0.

Exercise 3: Mixed integrand

Evaluate ∫−11(3x2+x3cos⁡x) dx\int_{-1}^{1} (3x^2 + x^3 \cos x)\,dx.

Answer

2

Solution
x3cos⁡x is odd→contributes 03x2 is even→2∫013x2 dx=2⋅1=2\begin{aligned} &x^3 \cos x \text{ is odd} && \to \text{contributes } 0 \\ &3x^2 \text{ is even} && \to 2 \int_0^1 3x^2\,dx = 2 \cdot 1 = 2 \end{aligned}

Exercise 4: A numerical symmetry checker

Write symmetry(f) that samples points x in [0.1, 3] and returns "even", "odd" or "neither" (using a tolerance of 1e-12). Test it on cos, tan and exp.

Answer

cos even, tan odd, exp neither

Solution
python · try it yourself
import math

def symmetry(f, tol=1e-12):
    xs = [0.1 + 0.29 * i for i in range(11)]
    if all(abs(f(-x) - f(x)) < tol for x in xs):
        return "even"
    if all(abs(f(-x) + f(x)) < tol for x in xs):
        return "odd"
    return "neither"

for f in [math.cos, math.tan, math.exp]:
    print(f.__name__, symmetry(f))
cos even
tan odd
exp neither

A sampled check can only disprove symmetry for sure; passing it is strong evidence, not a proof.

Test yourself

What is ∫−44xcos⁡(x2) dx\int_{-4}^{4} x\cos(x^2)\,dx?

  1. 2∫04xcos⁡(x2) dx2\int_0^4 x\cos(x^2)\,dx
  2. sin⁡(16)\sin(16)
  3. 0
  4. It cannot be computed

Which function is even?

  1. xsin⁡xx \sin x
  2. x2sin⁡xx^2 \sin x
  3. x+x2x + x^2
  4. exe^x

If ff is even and ∫05f(x) dx=7\int_0^5 f(x)\,dx = 7, what is ∫−55f(x) dx\int_{-5}^{5} f(x)\,dx?

  1. 0
  2. 7
  3. 3.5
  4. 14