# User:Saul/calculus

## Functions

Wikipedia provides a good definition for functions:

A function is a relation between sets that associates to every element of a first set exactly one element of the second set.

### Notations Used

Some quick definitions of the notations used:
{0, 1, 2} defines a set containing the items 0, 1 and 2.
Parentheses - () defines an exclusive interval and square brackets - [] define an inclusive interval, these can be mixed for example:

(0, 10) defines an interval containing the numbers 1 to 9
[0, 10] defines an interval containing the numbers 0 to 10
[0, 10) defines an interval containing the numbers 0 to 9

defines the set of real numbers: (-∞, ∞)
means union.
\ means excluding, for example: ℝ \ 0 is the set of real numbers excluding 0.
|x| is the absolute function of x
⌊x⌋ is the floor function of x
⌈x⌉ is the ceiling function of x
is to show including the point it is on (when drawing graphs).
is to show up to but not including the point it is on (when drawing graphs).

### Domain

The set the contains the valid inputs is called the function's domain.

For example take the function: ƒ(x) = x2
The domain for this function is: (-∞, ∞) or

Another example: ƒ(x) = 1/x
The domain for this function is: (-∞, 0) ∪ (0, ∞) or ℝ \ {0}

The domain of ƒ′ ≤ ƒ

### Range

The second set that contains the outputs is called the function's range.

Take the first example used in the domain section: ƒ(x) = x2
The range for this function is: [0, ∞)

And the second example: ƒ(x) = 1/x
The range for this function is ℝ \ {0}

### Types

There are many types of functions here are a few:

Linear - y = mx +c
Power - y = xa
Polynomial (to the degree n)
Trigonometric - Sin(x)
Exponential - ax
Logarithmic - loga(x)

### Vertical Line Test

You can visually test if a graphed curve is a function if you can draw a vertical line at any given point and have that line intersect no more than once.
This makes sense if you look back in the function's definition associates to every element of a first set exactly one element of the second set and hence if it intersects more than once the given x has more than one solution.

### Piecewise Functions

A piecewise function is a function described in pieces by applying a different formulae on different parts of it's domain.
This can be thought of as applying a condition on the inputs.
An example of this is the absolute function: |x|
This function outputs x if x ≥ 0 otherwise outputs -x if x < 0

### Composite Functions

A composite function is a function that is composed of other functions.

(ƒ ○ g)(x) = ƒ( g(x) )

For example:

ƒ(u) = un
g(x) = Sin(x)
(ƒ ○ g)(x) = Sinn(x)
(g ○ ƒ)(x) = Sin(xn)

### Injective/One-To-One Functions

A function ƒ(x) is considered injective/one-to-one on a domain D if ƒ(x1) ≠ ƒ(x2); whenever x1 ≠ x2; in D.

Similar to the vertical line test, there is a horizontal line test for testing if a function is injective over a given domain, if a horizontal line hits more than one point it is not injective at those spots.
This means if the function is continuous id will be decreasing or increasing over the entirety of that domain.

For example the function ƒ(x) = x2 is not injective over the Real Numbers because ƒ(1) = ƒ(-1) but if the domain was restriced to [0, +∞) it would be considered injective.

### Inverse Functions

Suppose that ƒ is an injective function on domain D with range E the inverse function ƒ-1 is defined by:

ƒ-1(y) = x if ƒ(x) = y

The domain of ƒ-1 is E and the range for it is D.
Please note: ƒ-1 is not referring to the 1 / ƒ.

### Symmetry

A function of x is considered:
Even if ƒ(-x) = ƒ(x)
Odd if ƒ(-x) = -ƒ(x)
Fore every item in the domain.

Even functions have a reflective symmetry about the origin.
Odd functions have a rotational symmetry of 180° about the origin.

### Increasing/Decreasing Intervals

A function is considered:

increasing if ƒ(x1) > ƒ(x2) where x1 < x2
decreasing if ƒ(x1) < ƒ(x2) where x1 < x2
non-decreasing if ƒ(x1) ≥ ƒ(x2) where x1 < x2
non-increasing if ƒ(x1) ≤ ƒ(x2) where x1 < x2

over a specific interval.

## Limits

From Wikipedia:

A limit is the value that a function (or sequence) "approaches" as the input (or index) "approaches" some value.

L is the limit of ƒ(x) as x approaches a.
This can be described using the following notation:
lim ƒ(x) = L
x → a
Or an alternative notation:
ƒ(x) → L as x → a

We can say the limit exists if L is finite.
We can make our function ƒ(x) as close as we like to L by choosing an x value as close as needed to a
The limit depends on the behavior of ƒ(x) near a but NOT at the value a - e.g. a may be undefined.

Take the following function as an example:
ƒ(x) = {x if x ≠ 0, 1 if x = 0
The limit for this function would be:
lim ƒ(x) = 0
x → 0

### Indeterminate Form

#### 0/0

0/0 is undefined however it can be calculated in indeterminate form using limits.
The following are some tricks for doings so.

##### Extracting a Common Factor

Take the following function for example:

ƒ(x) = (x3 - x2 + x - 1) / (x2 - 1)

Then find:

lim ƒ(x)
x → 1

Evaluating x at 1 gives the result 0/0 which is not useful.
We can extract out a common factor by first factorizing:

ƒ(x) = (x - 1)(x2 + 1) / (x - 1)(x + 1)

Note: we can only cancel these because we making x arbitrary close to 1 but this is not valid at 1
Cancelling the common factors will produce the following result:

ƒ(x) = (x2 + 1) / (x + 1)

Therefore:

lim ƒ(x) = lim (x2 + 1) / (x + 1)
x → 1        x → 1

Which evaluates at 1 therefore:

lim ƒ(x) = 1
x → 1
##### Method of Conjugates (Unfinished)

A conjugate is the inverse sign of two terms for example the conjugate of:

a + b

Would be:

a - b

It is a possibility that 0/0 occurs because:

ƒ(x) = (g(x) - h(x)) / v(x)

And

lim g(x) = lim h(x)
x → a         x → a

While

lim v(x) = 0
x → a

In this case we can try multiplying by 1 or more cleverly:

(g(x) + h(x)) / (g(x) + h(x))

Gives:

ƒ(x) = (g(x) + h(x)) * (g(x) - h(x)) / (g(x) + h(x)) * v(x)

And expanding:

ƒ(x) = (g2(x) - h2(x)) / (v(x) * g(x) + v(x) * h(x))

And evaluating...

##### Sandwich/Squeeze Theorem

If:

g(x) ≤ ƒ(x) ≤ h(x)
For all x near a except for possibly at a

And:

lim g(x) = lim h(x) = L
x → a         x → a

Then:

lim ƒ(x) = L
x → a

Example:

ƒ(θ) = Sin (θ) / θ

Find:

lim ƒ(θ)
θ → 0

To solve this first take a look at this image taken from this page that contains a sector and two triangles formed from part of a circle.

Inner Triangle ≤ Sector ≤ Outer Triangle

And if we say that the angle is θ (radians) and the radius is r, using the appropriate formulas for obtaining the area for triangles and sectors we can say:

(r2 Sin θ) / 2 ≤ (r2θ) / 2 ≤ (r2 Tan θ) / 2

Now we can simplify by dividing by:

(r2 Sin θ) / 2

Which gives:

1 ≤ θ / Sin(θ) ≤ 1 / Cos(θ)

Then we can inverse it:

1 ≥ Sin(θ) / θ ≥ Cos(θ)

And then rearrange so the signs face the right direction:

Cos(θ) ≤ Sin(θ) / θ ≤ 1

Now we can calculate some limits:

lim Cos(θ) = 1
θ → 0

lim 1 = 1
θ → 0

And since the following limits are equal:

lim 1 = lim Cos(θ)

We can substitute the result of these to show the following to be true:

1 ≤ lim Sin(θ) / θ ≤ 1
θ → 0

Therefore

lim ƒ(θ) = lim Sin(θ) / θ = 1
θ → 0        θ → 0

#### Infinity

##### Infinite Limits
lim ƒ(x) = ∞
x → a

An infinite limit is a limit where as x approaches a the outcome of ƒ(x) becomes
This means ƒ(x) becomes arbitrarily large (we can get as large as we need) as x approaches a
We treat infinite limits as does not exist.
Example:

lim 1/x = ∞
x → 0
##### Limits at Infinity
lim ƒ(x) = L
x → ∞

A limit at infinity is when the limit of a function becomes arbitrarily close to L for a large enough x.
Here are a few examples:

lim x = ∞
x → ∞

lim 1/x = 0
x → ∞

lim x = -∞
x → -∞

lim 1/x = 0
x → -∞

lim Sin(x) does not exist
x → ∞
This is because Sin(x) does not approach a specific value as x increases.
##### ∞/∞

When solving limits in indeterminate form we should avoid ∞/∞.
Take the following example:

ƒ(x) = (x2 + 2) / (x2 + 3)

Find:

lim ƒ(x)
x → ∞

We can try dividing the numerator and denominator by the highest power of x which in our case is x2:

ƒ(x) = (1 + 2 / x2) / (1 + 3 / x2)

Now we know that the following is true:

lim 1/x2 = 0
x → ∞

So we can substitute and solve:

lim ƒ(x) = (1 + 0) / (1 + 0) = 1
x → ∞

### One Sided

ƒ has a one-sided limit from the right/above if ƒ(x) approaches L as x approaches a through values larger than a.

limx → a+ ƒ(x) = L

Left handed limits are similar but the other way around, it has a one-sided limit from the left/below if ƒ(x) approaches L as x approaches a through values lower than a.

limx → a- ƒ(x) = L

Some examples:

lim x → 0 1/x does not exist.
lim x → 0+ 1/x = ∞
lim x → 0- 1/x = -∞
lim x → 0+ Sin(1/x) does not exist.

### Continuity

The function ƒ is continuous at a if:

lim ƒ(x) = ƒ(a)
x → a

This requires that the following things to be true:

1. ƒ(x) has to be defined.
2. The limit L has to exist.
3. L = ƒ(a)

#### Removable Discontinuity

If condition #2 is satisfied but not #1 or #2, we say that the discontinuity is removable by redefining ƒ(a) = L.
We can "fix" this discontinuity by extending the function ƒ as the function g:

g(x) = { ƒ(x) x ≠ a, limx → a ƒ(x) x = a

For example:

ƒ(x) = Sin(x) / x

This function has removable discontinuity at x = 0.
So we calculate its limit:

limx → 0 ƒ(x) = 1

We can make a new version of the function ƒ called g.

g(x) = { ƒ(x) x ≠ 0, 1 x = 0

#### Non-Removable Discontinuity

A function is said to have non-removable discontinuity if it has one of the following:

• Infinite Discontinuity
• ƒ(x) = 1 / x - There is infinite discontinuity at x = 0
• Jump Discontinuity
• This is when one-sided limits exist but are not equal.
• ƒ(x) = |x| / x - There is jump discontinuity at x = 0
• Oscillating Discontinuity
• ƒ(x) = Sin(1/x) - There is oscillating discontinuity at x = 0

#### Intermediate Value Theorem

If ƒ is continuous on [a, b] and ƒ(a) ≠ ƒ(b) then for every y0 between ƒ(a) and ƒ(b) there is at least one x0 in (a, b) for which ƒ(x0) = y0.

##### Corollary

If ƒ is continuous on [a, b] and ƒ(a) & ƒ(b) have opposite signs then ƒ(x) = 0 has at least one root in (a, b).
The function must cross the x-axis once or more between a and b.

#### Continuity Proof

If ƒ has a derivative at x=c then ƒ is continuous at at x=c.

Given ƒ′(c) exists show:

limx→c ƒ(x) = ƒ(c)

Is equal to:

limh→0 ƒ(c + h) = ƒ(c)

If h≠0 then:

ƒ(c + h) = ƒ(c) + ƒ(c + h) - ƒ(c)
ƒ(c + h) = (ƒ(c) + ƒ(c + h) - ƒ(c)) * h / h
limh→0 ƒ(c + h) = limh→0 (ƒ(c)) + limh→0 ((ƒ(c + h) - ƒ(c)) / h) * limh→0 (h)
ƒ(c + h) = ƒ(c) + ƒ′(c) * 0
ƒ(c + h) = ƒ(c)

## Differentiation

Differentiation of a function is taking a function (usually a curve) and finding the gradient at the single instant of x.
For example the function ƒ(x) = x2 will represent a 'U' shaped curve, the gradient at point x will be: ƒ(x) = 2x

### Formulae

The following is a how we get the derivative:
Take an arbitrary curve and draw a secant line through it (secant is a line that cuts through the graph), this line will (hopefully) intersect the curve at two points.
We use the following equation for the gradient of this line:

Δy/Δx (change in y over change in x)

Which can be calculated from the points (NOTE: y = ƒ(x)):

Δx = x1 - x0
Δy = ƒ(x1) - ƒ(x0)
Δy/Δx = (ƒ(x1) - ƒ(x0)) / (x1 - x0)

We can rearrange the definition for Δx to get a definition for ƒ(x1).

x1 = x0 + Δx

Now we can rewrite the equation using only x0 & Δx:

Slope = (ƒ(x0 + Δx) - ƒ(x0)) / Δx

This could be interpreted as the average rate of change for these two points.
Now the question is: what happens when Δx becomes very small to indicate a specific point that the gradient is taken, this can be achieved by using limits.

limx → 0 (ƒ(x0 + Δx) - ƒ(x0)) / Δx

The last equation is the formulae of the derivative.
If the limit does not exist then the slope at that point is not well defined.
The domain of the derivative consists of the points in the function where the limit exists.

### Various Notations

We will use the function notation ƒ(x) which just applies some action to x like this function will double x: ƒ(x) = 2x
A derivative of a function will be notated with ƒ, second derivatives are marked ƒ′′ and so on.

The following are various notations for derivatives.
Note that: y = ƒ(x) = ƒ

dy / dx
dƒ / dx
dƒ(x) / dx
y
[y]
ƒ
[ƒ]
D(ƒ)(x)
Dxƒ(x)

Notation for second derivative:
ƒ′′
d2y / dx2

### Various Rules

Note: n represents a real number, and a represents a constant.

ƒ(x) = xn
ƒ(x) = nxn-1

ƒ(x) = axn
ƒ(x) = anxn-1

ƒ(x) = a
ƒ(x) = 0

ƒ(x) = x
ƒ(x) = 1

ƒ(x) = fg
ƒ(x) = fg + gf

ƒ(x) = f/g
ƒ(x) = (fg - gf) / g2

(ƒ ○ g)(x)
(ƒ ○ g)(x)
ƒ( g(x) ) * g(x)

(ƒ ○ g ○ h)(x)
ƒ( g( h(x) ) ) * g( h(x) ) * h(x)

ƒ(x) = sin(x)
ƒ(x) = cos(x)

ƒ(x) = cos(x)
ƒ(x) = -sin(x)

ƒ(x) = tan(x)
ƒ(x) = 1 / cos2(x) = sec2(x)

ƒ(x) = sin(x)
ƒ′′′′(x) = sin(x)

ƒ(x) = sin(x)
ƒ(n)(x) = ƒ(m)(x)

Where m = n mod 4

### Uses

#### Finding x-Intercept

Differentiation can be used to find the x-intercepts of a line.
The following formulae is used to find this:
xn+1 = xn - ƒ(xn) / ƒ(xn)
Applying this function until ƒ(x) ≈ 0
The initial x is just a guess.
Note: if this results in divergence (x does not converge at 0 or x → ∞) then x1 was a bad guess.

#### Approximating Roots and Powers

Differentiation can be used to approximate roots.

For example approximating the answer to:
3√(120)

First round to the nearest known value:
3√(125) = 5

Differentiate the original equation:
ƒ(x) = 3√x = x1/3
ƒ(x) = x-2/3 / 3

Substitute the approximation:
ƒ(120) = 120-2/3 / 3
120-2/3 / 3 = 0.014

Place this into the equation of gradient:
(y - 5) / (x - 125) = 0.014

Prearrange to the formulae of a line:
y = 0.014x + 3.29

Substitute for the number to approximate with x:
y = 0.014(120) + 3.29
y = 4.934

Therefore:
3√(120) ≈ 4.934
3√(120) = 4.932 (calculated)

#### Turning Points

A turning point is the point where the gradient is 0, an equation may have multiple, quadratics usually have one, cubic functions usually have 2.

##### Locating

The turning point can be found by obtaining the first derivative (ƒ(x)).
Then solve for when ƒ(x) = 0.
The results of this are the x values of the turning points, the y values can be found by substituting the x values into the original equation.

##### Minimum and Maximum

A Minimum is the the turning point that is Concave Up.
A Maximum is the the turning point that is Concave Down.

The Minimum can be found where the first derivative (ƒ(x)) is 0 and the second derivative (ƒ′′(x)) is positive.
ƒ(x) = 0 and ƒ′′(x) > 0

The Maximum can be found where the first derivative (ƒ(x)) is 0 and the second derivative (ƒ′′(x)) is negative.
ƒ(x) = 0 and ƒ′′(x) < 0

##### Concave Up and Down

Concave Up is the part of the graph that is U shape.
Concave Down is the part of the graph that is n shape.
Cubic functions have one of each, quadratics have one or the other.

To find out if a point is Concave Up or Down, find the second derivative (ƒ′′(x)).
If ƒ′′(x) > 0, then the point is Concave Up.
If ƒ′′(x) < 0, then the point is Concave Down.

##### Point of Inflection

The Point of Inflection (P.O.I.) is the point on the graph where Concave Up changes to Concave Down.
The P.O.I. is when the second derivative (ƒ′′(x)) is equal to 0 and it changes from a negative value to a positive one immediately beforehand (or vice versa).

If:

ƒ′′(x) = 0
ƒ′′(x - 0.1) < 0
ƒ′′(x + 0.1) > 0

Or:

ƒ′′(x) = 0
ƒ′′(x - 0.1) > 0
ƒ′′(x + 0.1) < 0

Then:

x = P.O.I.

## Integration

Integration is the reverse of differentiation, sometimes known as anti-derivative.
Integration is usually noted like so:
ƒ(x)dx = ƒ(x) + c
Where dx shows that it will be the integral relative to x (there may be other variables in the equation).
c represents a unknown constant - this must exist because when a function is derived (differentiation) some information is lost so c is to make up for that loss.

### Various Rules

k represents a constant.
k dx = k + c

kx dx = kx dx

xn dx = xn + 1 / (n + 1)

(xn + xm) dx = xn dx + xm dx

( ƒ(x) ± g(x) )dx = ƒ(x)dx ± g(x)dx

(1 / x) dx = Ln(x) + c
Note: Ln(x) = Loge(x)

### Uses

#### Area

A use of integration is to find the area between a line and the x axis between two points on a graph.
The area between the two points a and b (where x = 0) can be found like so:

First find the derivative:

abƒ(x) dx = ƒ(x)

Say that the derivative is F, then find the difference of the values for F for each limit like so:

F(b) - F(a) = Area

Note that the area will be negative if it is under the x axis and positive if above.

Also if the line crosses the x axis more than twice then there will be more than two values where x = 0 and at least one positive area and a negative area, these will at least partially cancel each other out if only the left most and right most x values are taken, so to effectively calculate the area the absolute areas between every set of points (where x = 0) muse be calculated.

#### Solid of Revolution

A cool use for integration is to calculate a solid of revolution - the volume of a shape that is made from the area of two points spun around a axis, for example a triangle could create a cone.
The formulae for this is as follows:
V = Π ab ƒ2(x) dx

Note: ƒ2(x) = ƒ(x) * ƒ(x)