# Purpose Of Adding A Constant After Integrating A Function

I would like to know the whole purpose of adding a constant termed constant of integration everytime we integrate an indefinite integral $\int f(x)dx$. I am aware that this constant “goes away” when evaluating definite integral $\int_{a}^{b}f(x)dx$. What has that constant have to do with anything? Why is it termed as the constant of integration? Where does it come from?

The motivation for asking this question actually comes from solving a differential equation $$x \frac{dy}{dx} = 5x^3 + 4$$ By separation of $dy$ and $dx$ and integrating both sides, $$\int dy = \int\left(5x^2 + \frac{4}{x}\right)dx$$ yields $$y = \frac{5x^3}{3} + 4 \ln(x) + C .$$

I’ve understood that $\int dy$ represents adding infinitesimal quantity of $dy$’s yielding $y$ but I’am doubtful about the arbitrary constant $C$.

#### Solutions Collecting From Web of "Purpose Of Adding A Constant After Integrating A Function"

Sometimes you need to know all antiderivatives of a function, rather than just one antiderivative. For example, suppose you’re solving the differential equation
$$y'=-4y$$
and there’s an initial condition $y(0)=5$. You get
$$\frac{dy}{dx}=-4y$$
$$\frac{dy}{y} = -4\;dx$$
$$\int\frac{dy}{y} = \int -4\;dx$$
$$\log_e y = -4x + C.$$
Here you’ve added a constant. Then
$$y = e^{-4x+C} =e^{-4x}e^C$$
$$5=y(0)= e^{-4\cdot0}e^C = e^C$$
So
$$y=5e^{-4x}.$$

(And sometimes you need only one antiderivative, not all of them. For example, in integration by parts, you may have $dv=\cos x\;dx$, and conclude that $v=\sin x$.)

The key concept to note here is that when you differentiate a constant you get 0, this is due to the fact that the slope of the tangent line of a constant function, say $f(x) = 4$, will simply be a horizontal line spanning the x-axis with a slope of zero everywhere.

When you differentiate a particular function that has a constant at the end, say $f(x) = x^2 +2x +4$ to get $f'(x) = 2x +2$, you have no way, given only the derivative $f'(x)$, to recover the “constant information” about the original function.

This is precisely why you have to have a slope field representation of the anti-derivative of a function. When you integrate a particular function, you must add that $+C$ because it says that, the anti-derivative of the function could be one of any of the slope field lines in $\mathbb{R}^2$. The particular value for $C$ collapses it to exactly one of these slope field lines. Here is a graphical representation of a slope field and three particular values of $C$ that draw out the purple functions. The slope field anti-derivative is given by:
$$\int \cos(x) dx = \sin(x) +C$$

The three purple functions drawn out are:
$$f(x) = \sin(x) -2$$
$$f(x) = \sin(x) + 0$$
$$f(x) = \sin(x) +2$$

It may also make more sense when you take a differential equations course, but this should be a sufficient explanation.

The indefinite integral $\int f(x)dx$ is the function $F(x)$ such that $\frac{d}{dx}F(x) = f(x)$. Problem is, there are multiple (in fact infinitely many) such functions $F(x)$. We cannot allow the expression $\int f(x)dx$ to refer to multiple functions, so to get around this we introduce the constant of integration $C$. This fixes things, because though there are infinitely many $F(x)$ such that $\frac{d}{dx}F(x) = f(x)$, if we pick any single such function $F(x)$ then all solutions to $\frac{d}{dx}G(x) = f(x)$ are of the form $G(x) = F(x) + C$ for some value of $C$, while for any value of $C$ the function $F(x)+C$ satisfies $\frac{d}{dx}(F(x)+C) = f(x)$. Hence we say $\int f(x)dx = F(x) + C$.

The indefinite integral $\int f(x) dx$ denotes, in this particular context, the set of all primitives of $f(x)$. If you find one primitive, say $F(x)$, then you know all other primitives have the form $F(x) + C$, where $C$ is any constant. This is what we mean when we write $\int f(x) dx = F(x) + C$: the set of all primitives of $f(x)$ is the set of all the functions of the form $F(x) + C$.

The indefinite integral $\int f(x)\,dx$ is defined to be the general class of functions whose derivatives are $f(x)$.

Now, given any function $F$ with $F'=f$, it follows that $F+C$ is also an antiderivative of $f$:
$$(F+C)'=F'+C'=F'+0=F'=f.$$
Conversely if $G$ is an antiderivative of $f$, then $G$ has the form $F+C$ for some constant $C$.

That’s why we write, for example:
$$\tag{1} \int x^2\,dx={x^3\over 3}+C.$$
The derivative of ${x^3\over 3}+C$ is $x^2$. Moreover if $F'(x)=x^2$, then $F$ must have the form $F(x)={x^3\over3}+C$.

So, the general antiderivative of $f(x)=x^2$ has the form $F(x)={x^3\over3}+C$, and equation (1) is just stating this fact.

The differential equation you are considering has more than one solution. The general solution is as you have, with the arbitrary parameter $C$. It does belong there.
Any function of that form will be a solution to the equation.

If you were given an initial value problem where, say, you needed $y(1)=2$, then that constant $C$ could be determined.

The “integration constant” $C$ does have the “purpose” to make a seemingly true equation at least halfway true. In fact it is what many people call a “dangling variable”, similar to the $i$ and $k$ when we talk about a “matrix $\bigl[a_{ik}\bigr]\$”. As noted in other answers, an indefinite integral is not a function, but an infinite set of functions, any two of them differing by a constant. Writing $\langle F(x)\rangle$ (or similar) instead of $F(x)+C$ for the set of all functions differing from the term $F(x)$ by a constant, one could write, e.g.,
$$\int (5x -6x^4)\ dx =\langle {5\over2} x^2-{6\over5} x^5\rangle\ ,$$
and the mysterious constant has disappeared.

It is simply a special case of the ubiquitous linear principle that the general solution of a nonhomogeneous linear equation is given by adding any particular solution to the general solution of the associated homogeneous equation. Namely, if $\rm\:D\:$ is a linear map then one easily proves

Lemma $\ \$ If $\rm\ D\:f_1\ =\ g\$ then $\rm\ D\:f_2\ =\ g\ \iff\ 0\ =\ D\:f_1 – D\:f_2\ =\ D\:(f_1-f_2)$

Therefore $\rm\ D^{-1}(g)\ =\ f_1\ +\ ker\ D\ =\:\:$ particular + homogeneous solution, as in linear algebra.

In particular $\rm\quad\:\: \int g\ =\ f_1\: +\ c,\$ for $\rm\ c\in ker\ \dfrac{d}{d\:x}\: =\:\:$ constants w.r.t. the derivation $\rm\ D\: =\: \dfrac{d}{d\:x}\:.$

Compare this to $\rm \ x\ =\ 3\ +\ 5\ \mathbb Z\:,\:$ the solution of $\rm\ 2\: x\ \equiv\ 6\pmod{10}\:,\:$ with particular solution $\rm x \equiv 6/2 \equiv 3\:,\:$ and homogeneous: $\rm\ 2\: x\:\equiv 0\pmod{10}\iff 10\:|\:2\:x\iff 5\:|\:x\iff x\in 5\ \mathbb Z\:.$

There are many great answers here, but I just wanted to chime in with my favorite example of how things can go awry if one forgets about the constant of integration.

Consider
$$\int \sin(2x) dx.$$
We will find antiderivatives in two ways. First, a substitution $u=2x$ yields:
$$\int \frac{\sin(u)}{2}du = -\frac{\cos(u)}{2} = -\frac{\cos(2x)}{2}.$$
Second, we use the identity $\sin(2x)=2\sin(x)\cos(x)$ and a substitution $v=\sin(x)$:
$$\int \sin(2x)dx = \int 2\sin(x)\cos(x)dx = \int 2vdv =v^2 = \sin^2(x).$$
Thus, we have found two antiderivatives of $\sin(2x)$ that are completely different! Namely
$$F(x)=\sin^2(x) \quad \text{and} \quad G(x)=-\frac{\cos(2x)}{2}.$$
Notice that $F(x)=\sin^2(x)\neq -\cos(2x)/2=G(x)$. For instance, $F(0)=\sin^2(0) = 0$ but $G(0)=-\cos(2\cdot 0)/2=-1/2$. So, what happened?

We forgot about the constant of integration, that’s what happened. The theory of integration tells us that all antiderivatives differ by a constant. So, if $F(x)$ is an antiderivative, then any other antiderivative $G(x)$ can be expressed as $G(x)=F(x)+C$ for some constant $C$. In particular, our antiderivatives above must differ by a constant. Indeed, the constant $C$ in this case is exactly $C=-\frac{1}{2}$:
$$F(x)+C = F(x) – \frac{1}{2} = \sin^2(x)-\frac{1}{2} = \frac{(1-\cos(2x))}{2}-\frac{1}{2} = -\frac{\cos(2x)}{2} = G(x),$$
where we have used the trigonometric identity $\sin^2(x) = (1-\cos(2x))/2.$