# Integration and Antiderivatives

Computer Science I · Calculus · https://tryals.app/learn/computer-science-i/integration-and-antiderivatives

## Undoing the Derivative

**Integration** is the reverse of differentiation. An **antiderivative** of $f$ is a function $F$ where $F'(x) = f(x)$, recovering original totals from rates of change.

Antiderivatives are not unique. Because the derivative of a constant is zero, adding $C$ yields the **indefinite integral**:

$\int f(x)\, dx = F(x) + C$

| Case | Rule | Pitfall |
| --- | --- | --- |
| **General** | $\int x^n\, dx = \frac{x^{n+1}}{n+1} + C$ ($n \neq -1$) | Raising the power, not lowering |
| **Special** | $\int \frac{1}{x}\, dx = \ln|x| + C$ | Fails when $n = -1$ |

**Common pitfall:** Forgetting the **constant of integration** $+C$. Infinitely many functions share the same derivative, differing only by a vertical shift.

## Rules and Techniques

Integration rules directly reverse standard differentiation rules. Constants factor out, and the integral of a sum equals the sum of the integrals.

| Function $f(x)$ | Indefinite Integral $\int f(x)\, dx$ |
| --- | --- |
| $\cos x$ | $\sin x + C$ |
| $e^x$ | $e^x + C$ |
| $\frac{1}{x}$ | $\ln|x| + C$ |

More complex integrals require advanced tools:

- **Substitution**: Reverses the chain rule.
- **Integration by parts**: Reverses the product rule.

**Common pitfall:** Applying the derivative power rule (bringing the exponent down) instead of the integration power rule (raising the exponent and dividing).

## Practice questions

4 of this lesson's 11 practice questions, with answers. The full set is in the app.

### 1. Solving a linear system by computing the inverse is correct mathematics and discouraged in code. What are the two objections?

A. That the inverse may not exist, which elimination handles
B. That the two methods give different answers, and the inverse's is wrong
C. Cost and accuracy: it solves n systems where you needed one
D. That matrix multiplication is slower than elimination for all sizes

**Answer:** C. Cost and accuracy: it solves n systems where you needed one

**Why:** Roughly n³ against n³/3, plus more roundings on an ill-conditioned matrix. The formula x = A⁻¹b states what the solution is; it was never an instruction for computing it, which is why `solve` exists and calling `inv` first is the classic tell of someone translating algebra directly into code.

Page: https://tryals.app/practice/computer-science-i/integration-and-antiderivatives/solving-a-linear-system-by-computing-the-inverse-is-correct

### 2. Select every function below that is an antiderivative of f(x) = 2x.

A. x^2 - 3
B. x^3 / 3
C. 2
D. x^2
E. x^2 + 7

**Answer:** A. x^2 - 3; D. x^2; E. x^2 + 7

**Why:** x^2, x^2 + 7 and x^2 - 3 all differentiate to 2x, differing only by a vertical shift. The constant 2 differentiates to 0, and x^3/3 differentiates to x^2, that last one is the result of integrating 2x with the wrong rule applied twice.

Page: https://tryals.app/practice/computer-science-i/integration-and-antiderivatives/select-every-function-below-that-is-an-antiderivative-of-f-x-2x

### 3. Substitution reverses the chain rule and integration by parts reverses the product rule. Why does integration have a technique per differentiation rule rather than one general method?

A. Because integration is harder to compute than differentiation on a machine.
B. Because differentiation is mechanical and integration is pattern matching.
C. Because integration is only defined for functions that are derivatives of something.
D. Because the rules of integration have not yet been fully discovered.

**Answer:** B. Because differentiation is mechanical and integration is pattern matching.

**Why:** Differentiating is algorithmic — identify the outermost structure, apply the rule, recurse — with never a choice, which is why symbolic differentiation is easy to program. Integration runs it backwards and requires recognising which rule *could* have produced this expression. The deeper fact is that many elementary functions have no elementary antiderivative.

Page: https://tryals.app/practice/computer-science-i/integration-and-antiderivatives/substitution-reverses-the-chain-rule-and-integration-by-parts

### 4. A function F satisfies F'(x) = 3x^2 and F(1) = 10. Compute F(3).

**Answer:** 36

**Why:** C = 9, so F(3) = 27 + 9 = 36. Forgetting the constant gives 27, and a nine-unit error that no amount of correct antidifferentiation can repair. The constant is not decoration; it carries real information.

Page: https://tryals.app/practice/computer-science-i/integration-and-antiderivatives/a-function-f-satisfies-f-x-3x-2-and-f-1-10-compute-f-3
