# Integral of cos x: Formula, Derivation and Examples

> The integral of cos x is sin x + C. See why there is no minus sign, the area of one hump, cos(ax + b) by substitution and worked definite integral examples.

Source: https://practicecalculus.com/integrals/cos-x
Updated: 2026-11-06

$$ \int \cos x\,dx = \sin x + C $$

## At a glance

- **Antiderivative:** $\sin x + C$
- **Area of one hump:** $\int_{-\pi/2}^{\pi/2}\cos x\,dx = 2$
- **Full period:** $\int_0^{2\pi}\cos x\,dx = 0$
- **Linear form:** $\int\cos(ax + b)\,dx = \dfrac{1}{a}\sin(ax + b) + C$
- **Check:** $\dfrac{d}{dx}\sin x = \cos x$

## Key takeaways

- The integral of $\cos x$ is $\sin x + C$, with no minus sign.
- The hump of $\cos x$ from $-\frac{\pi}{2}$ to $\frac{\pi}{2}$ has area $2$.
- For $\cos(ax + b)$, divide by $a$: $\int\cos(2x)\,dx = \frac{1}{2}\sin(2x) + C$.
- The minus sign belongs to the other pair: $\int\sin x\,dx = -\cos x + C$.

The **integral of $\cos x$ is $\sin x + C$**. Because the derivative of $\sin x$ is exactly $\cos x$, this is one of the cleanest integrals there is.

$$\int \cos x\,dx = \sin x + C$$

## Graph of cos x and its antiderivative

```graph
title: 'Area under y = cos x from -π/2 to π/2, with the antiderivative y = sin x'
caption: 'The shaded hump has area $\sin\frac{\pi}{2} - \sin\left(-\frac{\pi}{2}\right) = 2$. The dashed curve $y = \sin x$ climbs from $-1$ to $1$ across the same interval.'
x: [-3.5, 5]
y: [-1.6, 1.6]
functions:
  - expr: cos(x)
    label: y = cos x
  - expr: sin(x)
    label: y = sin x (antiderivative)
    dashed: true
shade: {expr: cos(x), from: -1.5708, to: 1.5708}
points:
  - [1.5708, 1, '(π/2, 1)']
```

The antiderivative $\sin x$ peaks at $x = \frac{\pi}{2}$, exactly where $\cos x$ crosses zero from positive to negative.

## Derivation, step by step

1. Ask: which function has derivative $\cos x$?
2. The [derivative of sin x](/derivatives/sin-x) is $\cos x$.
3. So $\sin x$ is an antiderivative of $\cos x$.
4. Add $C$ to include every antiderivative: $\sin x + C$.

No sign fix is needed here, unlike the [integral of sin x](/integrals/sin-x).

## Check by differentiating

$$\frac{d}{dx}(\sin x + C) = \cos x \checkmark$$

## Definite integrals

| Integral | Value |
| --- | --- |
| $\int_0^{\pi/2}\cos x\,dx$ | $\sin\frac{\pi}{2} - \sin 0 = 1$ |
| $\int_0^{\pi/6}\cos x\,dx$ | $\frac{1}{2}$ |
| $\int_0^{\pi}\cos x\,dx$ | $0$ |
| $\int_{-\pi/2}^{\pi/2}\cos x\,dx$ | $2$ |

Since $\cos x$ is even, $\int_{-a}^{a}\cos x\,dx = 2\int_0^a\cos x\,dx = 2\sin a$.

## Substitution variants

With $u = ax + b$:

$$\int\cos(ax + b)\,dx = \frac{1}{a}\sin(ax + b) + C$$

For example, $\int\cos(4x - 1)\,dx = \frac{1}{4}\sin(4x - 1) + C$, and $\int\cos(\pi x)\,dx = \frac{1}{\pi}\sin(\pi x) + C$.

When the inside derivative appears as a factor, use [u-substitution](/rules/u-substitution-rule):

$$\int \cos x\,e^{\sin x}\,dx = e^{\sin x} + C \quad (u = \sin x)$$

$$\int \cos x\,\sin^3 x\,dx = \frac{\sin^4 x}{4} + C \quad (u = \sin x)$$

$$\int \frac{\cos(\sqrt{x})}{\sqrt{x}}\,dx = 2\sin(\sqrt{x}) + C \quad (u = \sqrt{x})$$

For the last one, $du = \frac{1}{2\sqrt{x}}dx$, so $\frac{dx}{\sqrt{x}} = 2\,du$.

## Worked examples

**Example 1.** $\int(2\cos x - 3\sin x)\,dx = 2\sin x + 3\cos x + C$. Note how the minus in front of $\sin$ combines with the minus in $-\cos x$ to give $+3\cos x$.

**Example 2.** $\int_0^{\pi/4}\cos(2x)\,dx = \left[\frac{1}{2}\sin(2x)\right]_0^{\pi/4} = \frac{1}{2}\sin\frac{\pi}{2} = \frac{1}{2}$.

**Example 3: an initial value problem.** If $f'(x) = \cos x$ and $f(0) = 3$, then $f(x) = \sin x + C$ and $f(0) = C = 3$, so $f(x) = \sin x + 3$.

**Example 4: simple harmonic motion.** If a spring has velocity $v(t) = 4\cos(2t)$ and position $s(0) = 0$, then $s(t) = 2\sin(2t)$. The amplitude is $2$.

## Common mistakes

1. **Writing $-\sin x$.** That is the derivative of $\cos x$, not the integral.
2. **Forgetting to divide by $a$.** $\int\cos(3x)\,dx = \frac{1}{3}\sin(3x) + C$, not $\sin(3x) + C$.
3. **Integrating $\cos^2 x$ as $\sin^2 x$ or $\frac{\cos^3 x}{3}$.** Powers of trig functions need identities. See the [integral of cos² x](/integrals/cos-squared-x).
4. **Integrating $\cos(x^2)$ as $\frac{\sin(x^2)}{2x}$.** You cannot divide by a variable inside derivative. $\int\cos(x^2)\,dx$ has no elementary antiderivative.

Practise with [trig integral problems](/practice-problems/trig-integrals).

## Frequently asked questions

### What is the integral of cos x?

The integral of $\cos x$ is $\sin x + C$.

### What is the integral of cos(2x)?

It is $\frac{1}{2}\sin(2x) + C$. Check: the derivative of $\frac{1}{2}\sin(2x)$ is $\frac{1}{2}\cdot 2\cos(2x) = \cos(2x)$.

### What is the integral of cos x from 0 to π?

It is $\sin\pi - \sin 0 = 0$. The area above the axis on $\left[0, \frac{\pi}{2}\right]$ cancels the area below on $\left[\frac{\pi}{2}, \pi\right]$.

### Is the integral of cos x equal to -sin x?

No. $-\sin x$ is the derivative of $\cos x$. The integral is $+\sin x + C$.
