calculus25 min

Antiderivatives

Reversing differentiation to find antiderivatives, indefinite integrals, and the constant of integration

0/9Not Started

Why This Matters

Differentiation tells you the rate of change of a function. But what if you know the rate and want to recover the original function? If you know velocity, can you find position? If you know how fast revenue is growing, can you find total revenue? This is the problem of antidifferentiation -- running the derivative process backward.

The indefinite integral is the notation for the antiderivative. The integral sign with no bounds represents the family of all functions whose derivative equals the integrand. The power rule in reverse says: to antidifferentiate x^n, add 1 to the exponent and divide by the new exponent. So the antiderivative of x^2 is x^3/3.

But there is a catch. Since the derivative of any constant is zero, if F(x) is an antiderivative of f(x), then so is F(x) + 7, or F(x) - 100, or F(x) + C for any constant C. This constant of integration represents the unknown starting point. You need an initial condition (like "the position at time 0 is 5") to pin down the specific antiderivative.

Define Terms

Visual Model

f(x)The function you are given
Differentiatef(x) -> f prime(x)
f prime(x)The derivative
Antidifferentiatef prime(x) -> f(x) + C
F(x) + CFamily of antiderivatives
Initial ConditionF(a) = value pins down C
Specific F(x)One particular antiderivative

The full process at a glance. Click Start tour to walk through each step.

Antidifferentiation reverses the derivative. The constant of integration C accounts for the information lost during differentiation.

Code Example

Code
// Antiderivative of a polynomial using reverse power rule
// If f(x) = sum of a_i * x^i, then F(x) = sum of a_i * x^(i+1) / (i+1) + C

function polyAntiderivativeAt(coeffs, x, C = 0) {
  // coeffs[i] is the coefficient of x^i
  let result = C;
  for (let i = 0; i < coeffs.length; i++) {
    result += coeffs[i] * Math.pow(x, i + 1) / (i + 1);
  }
  return result;
}

// Antiderivative of 3x^2 + 2x + 1 is x^3 + x^2 + x + C
const coeffs = [1, 2, 3]; // 1 + 2x + 3x^2
console.log("f(x) = 3x^2 + 2x + 1");
console.log("F(x) = x^3 + x^2 + x + C\n");

// Verify: derivative of the antiderivative should equal the original
function numericalDeriv(f, x, h = 0.00001) {
  return (f(x + h) - f(x - h)) / (2 * h);
}

for (const x of [0, 1, 2, 3]) {
  const F = polyAntiderivativeAt(coeffs, x);
  const fOriginal = 3 * x * x + 2 * x + 1;
  const derivOfF = numericalDeriv(t => polyAntiderivativeAt(coeffs, t), x);
  console.log(`x=${x}: F(x)=${F.toFixed(4)}, F prime(x)=${derivOfF.toFixed(4)}, f(x)=${fOriginal}`);
}

// Solving for C using initial condition
console.log("\nWith initial condition F(0) = 5:");
const C = 5; // F(0) = 0 + 0 + 0 + C = C = 5
for (const x of [0, 1, 2]) {
  console.log(`F(${x}) = ${polyAntiderivativeAt(coeffs, x, C).toFixed(4)}`);
}

// Position from velocity: if v(t) = 3t^2, then s(t) = t^3 + C
console.log("\nPosition from velocity:");
console.log("v(t) = 3t^2, s(0) = 10");
const velocity = [0, 0, 3]; // 3t^2
const s0 = 10; // initial position
for (const t of [0, 1, 2, 3]) {
  const pos = polyAntiderivativeAt(velocity, t, s0);
  console.log(`t=${t}: position = ${pos.toFixed(2)}`);
}

Interactive Experiment

Try these exercises:

  • Find the antiderivative of 5x^4 and verify by differentiating your answer.
  • What is the antiderivative of x^(-1) = 1/x? (Hint: the power rule does not work when n = -1. The answer is ln|x| + C.)
  • If acceleration a(t) = 10 (constant gravity), velocity v(0) = 20, and position s(0) = 0, find the position function s(t).
  • Find two different antiderivatives of 2x that differ by 7. Verify that both have derivative 2x.
  • Antidifferentiate cos(x) and verify numerically that the derivative of your answer is cos(x).

Quick Quiz

Coding Challenge

Compute Polynomial Antiderivative

Write a function called `polyAntideriv` that takes an array of polynomial coefficients (where coeffs[i] is the coefficient of x^i), a value x, and a constant C. Return the antiderivative evaluated at x. The reverse power rule says: the antiderivative of a_i * x^i is a_i * x^(i+1) / (i+1). Add C at the end. Round to 4 decimal places.

Loading editor...

Real-World Usage

Antiderivatives are essential for recovering quantities from their rates:

  • Physics: Position is the antiderivative of velocity; velocity is the antiderivative of acceleration. Every kinematics problem uses antiderivatives.
  • Economics: Total cost is the antiderivative of marginal cost. Total revenue is the antiderivative of marginal revenue.
  • Probability: The cumulative distribution function (CDF) is the antiderivative of the probability density function (PDF).
  • Engineering: Charge is the antiderivative of current in electrical circuits. Displacement is the antiderivative of strain in materials science.
  • Differential equations: Solving a differential equation often means finding an antiderivative, making this the gateway to ODEs.

Connections