 # Integrals

Integrals, in essence, are the opposite of derivatives.

Consider the following cost function, f(x) = x2/10 + 1.

You see this cost function and are asked to find the marginal cost function for it.  Realizing that the marginal cost is simply the derivative of cost, you take the derivative of f(x) to find the marginal cost function, f'(x) = x/5:

You feel accomplished for taking this derivative properly... but then curiosity strikes. You wonder: "Is there a way to go backwards in this problem? Could I find the cost function, f(x), from just the marginal cost, f'(x)?"

You can, with integrals!

Integrals are used to reverse derivatives, using antiderivatives.

## How to write an integral

Previously with Derivatives, we detailed the following notations for derivatives:

Luckily for integrals, the notation is a lot more straightforward and standardized! If we were to take the derivative of f(x), resulting in the integral function F(x), this is the notation we'd use!

This expression is read as “capital f(x) = the integral of f(x) dx”.

Let’s break down this expression…

The curvy symbol in the very front, resembling an s, is the symbol that denotes integration happening.

f(x) is the function that is being integrated.

F(x) is the result of integrating the function, f(x).

dx is used to denote the variable that you are integrating with respect to. In the case of "dx", it basically means we're taking the "derivative of x".

## How to evaluate an integral

When you're faced with an integral problem, you must evaluate it.

You'll be faced with many types of functions that you'll need to know how to take the integral of. Lucky for you, there's a couple tricks / methods that you can apply to easily evaluate their integrals!

### Method 1 - Reverse Power Rule

With the Power Rule in Derivatives, we utilized the following template to apply it:

For example, if we had a f(x) = x2 (with n = 2), we could apply the reverse power rule like so:

This would result in the following integral output:

In summary, with the reverse-power rule (with integrals), we must (1) increase the exponent by one and then (2) divide our expression by the exponent.

This is essentially the reverse of the power rule (with derivatives)!

One thing to remember with the reverse power rule...

The reverse power rule doesn't work with n = -1. This would result the denominator to be 0. When faced with n = -1, utilize the natural log equation ln(ⅠxⅠ)! (ⅠxⅠ represents the absolute value of x!)

When n = -1, you're working with a function like this...

...which can be rewritten to this:

And when we check out the integrals to memorize below...

...we can see that the integral of 1/x is ln(|x|) + C!

### Method 2 - Integrals to memorize

Here are some integrals that you should just go ahead and memorize to make your life easier:

Notice how these are pretty much the exact same as the derivatives list of "Integrals to memorize", just reversed!

### Method 3 - Chain Rule (with coefficients)

When we have a function with a coefficient and need to take the integral of it, we'll use the following template:

For example, if we had a function like so with coefficient "a"...

...we'd move the coefficient "a" outside the integral...

...and proceed like so, applying the reverse power rule to x2...

...resulting in a final answer of x3 + C!

#### When working with a constant...

What if I asked you to take the integral of the following constant?

You might be tempted to cast this aside as 0 and move on... but remember: anything to the power of zero is 1! So technically, there's an x0 next to our constant of 5 here!

So, we'd move the coefficient "a" outside...

...and then apply the reverse power rule (with n = 0)...

...we get the resulting integral, 5x + C!

Constants don't cancel out with integrals! There's technically an x0 next to them!

### Method 3 - Sum Rule

(Note that this rule is pretty much the exact same as with derivatives!)

When you're faced with a function finding the sum / using addition, utilize the following rule:

For example, if we were faced with the following function...

...we'd separate each part of the function by the plus sign and evaluate the integral...

...and then take the integral of each (individually)...

...resulting in the following answer (when simplified)!

### Method 4 - Difference Rule

(Note that this rule is pretty much the exact same as with derivatives!)

When you're faced with a function finding the difference / using subtraction, utilize the following rule:

For example, if we were faced with the following function "f(x)" using subtraction...

...we'd separate each part of the function by the minus sign and evaluate the integral...

...resulting in the following...

...which, when simplified, results in this as our answer!

## Okay... what's this "+ C" thing?

You'll notice that at the end of all the integrals above, we've got "+ C".

This is referred to as the "constant of integration".

"You wonder: 'Is there a way to go backwards in this problem? Could I find the cost function, f(x), from just the marginal cost, f'(x)?'"

...and now that we've learned integrals, we can!

When we take the integral of the marginal cost function, f'(x), to find the cost function, f(x)...

...we can pull out 1/5 with the chain rule...

...and then apply the power rule (with n = 1)...

...and find the following formula for f(x).

But wait... at the start of this article, we said the following:

"Consider the following cost function, f(x) = x2/10 + 1."

We've got the x2/10 part... what about the + 1? Why is that part not present in our integral?

This is because:

The derivative of any constant is zero.

Herein lies the value of the constant of integration!

When working with indefinite integrals, we use the constant of integration to account for the fact that there may have been a constant that got "derivatived" out in the original function. Writing the constant of integration "+C" acknowledges we recognize that.

The "+ C" in out integral output...

...accounts for, in this case, the "+ 1" in our actual cost function!

"Consider the following cost function, f(x) = x2/10 + 1."