A sequence is defined as an ordered list of numbers.
- Sequences are ordered, meaning two sequences that contain the same values but in a different order are not equal.
- Sequences can be infinite if a rule is defined, i.e $\{1, 1, 1, 1, ...\}; a_i = 1$ 

# Behavior
- A sequence is considered **increasing** if $a_n$ is smaller than $a_{n+1}$ for all $n$.
- A sequence is considered **decreasing** if $a_n$ is greater than or equal to $a_{n+1}$ for all $n$.
- Sequences exist that do not fall into either category, i.e, $a_n = (-1)^n$

- If the terms of a sequence grow $\{a_n\}$ get arbitrarily close to a single number $L$ as $n$ grows larger, this is noted by writing:
$$\lim_{n\to\infty} a_n = L$$ OR
$$ a_n \to L \text{ as } n \to \infty $$

and say that $a_n$ *converges* to $L$. If no $L$ exists, we say $\{a_n\}$ *diverges*.

# Properties of Sequences
> The below properties assume two sequences are defined, $a_n \to L$ and $b_n \to M$
1. $a_n + b_n \to L + M$
2. $C*a_n \to CL$ 
3. $a_n b_n \to LM$
4. $\frac{a_n}{b_n} \to \frac{L}{M}$ holds true where all values are defined
5. If $L = M$ and a sequence $c_n$ exists such that $a_n \le c_n \le b_n$ for all $n$, then $c_n \to L = M$
6. If $a_n$ and $b_n$ both approach infinity at a similar rate, $\frac{a_n}{b_n}$  will approach an arbitrary value. This value can be found by rewriting $\frac{a_n}{b_n}$ in such a manner that the end behavior of the series is more easily identifiable
	> For example, given the series $c_n = \frac{n}{2n+1}$, both the numerator and the denominator approach infinity at a similar rate. However, when the numerator and denominator are both multiplied by $\frac{1}{n}$, it becomes $\frac{1}{2+\frac{1}{n}}$, an equivalent sequence that more clearly converges on $1/2$. 

# Sum of an infinite sequence
- If $f(x)$ is a function and $\{a_n\}$ is a sequence such that $f(n) = a(n)$, then we say $f(x)$ *agrees* with the sequence  $\{a_n\}$ 
- If $f(x)$ agrees with $\{a_n\}$ then if $\lim_{x \to \infty}f(x) = L$  then $\lim_{n \to \infty}a_n = L$
- Given the above knowledge, we can apply L'Hospital's rule to sequences that seem to approach $\frac{\infty}{\infty}$.

Remember, L'Hospital's rule states that:

>If you have a limit of the indeterminate form $\dfrac{0}{0}$, the limit can be found by taking the derivative of the numerator, divided by the derivative of the denominator.
> $$ \lim_{x \to 2} \dfrac{x-2}{x^2-4} = \lim_{x \to 2} \dfrac{1}{2x}$$
> L'Hospital's Rule can also be used when both the numerator and denominator approach some form of infinity.
>$$ \lim_{x \to \infty} \dfrac{x^2-2}{3x^2-4} = \lim_{x \to \infty} \dfrac{2x}{6x}$$
>The above problem can be solved more easily *without* L'Hospital's rule, the leading coefficients are 1/3, so the limit as $x$ approaches $\infty$ is 1/3.
> L'Hospital's rule **cannot** be used in any other circumstance. 

# Series
Vocabulary: A **series** is another name for a sum of numbers. 

## The Limit Test
You can break a series into *partial sums*:
$$\sum_{n=1}^\infty a_n = a_1 + a_2 + a_3 + ...$$
Given the above series, we can define the following:
- $S_1 = a_1 = \sum_{i=1}^\infty a_i$
- $S_2 = a_1 + a_2 = \sum_{i=1}^2 a_i$ 
- $S_n = a_1 + a_2 + ... = \sum_{i=1}^n a_i$
- If the limit of $S_n$ as $S_n$ approaches $\infty$ converges to $L$, then we write:
  $$\sum_{n=1}^\infty a_n = L$$
and say that the sum converges to $L$. 

## Examples
> Prove that $\sum_{n = 1}^\infty \frac{1}{2^n} = 1$
- $S_1 = \frac{1}{2}$
- $S_2 = \frac{1}{2} + \frac{1}{4} = \frac{3}{4}$ 
- $S_3 = \frac{1}{2} + \frac{1}{4} + \frac{1}{8} = \frac{7}{8}$ 
- $S_n = \frac{2^n - 1}{2^n}$
So:
$$ \sum_{n=1}^\infty \frac{1}{2^n} = \lim_{n \to \infty}S_n = \lim_{n \to \infty} (1 - \frac{1}{2^n}) = 1$$

> Using the limit test, determine whether the series $\sum_{n = 1}^\infty n$  converges or diverges
- $S_1 = 1$
- $S_2 = 1 + 2 = 3$
- $S_n = \frac{n(n+1)}{2}$ 
So: 
$$ \lim_{n \to \infty} \frac{n(n+1)}{2} = \infty $$

Given the above info, the limit is non-zero, so we know that the series diverges.

# Geometric Series
A geometric series of the form:
$$ \sum_{n = 1}^\infty ar^{n-1} = \sum_{n=0}^\infty ar^n $$
Converges to $\dfrac{a}{1-r}$  if $|r| < 1$ or diverges if $|r| >= 1$. 

# Examples:

> Determine if the series $\sum_{n=1}^{\infty}35(7^{-n} * 2^{n-1})$ diverges or converges. If it converges, state where.
1. Rewrite $7^{-n}$ as $(\frac{1}{7})^n$ to be closer to the form $ar^n$
$$ = \sum_{n=1}^\infty 35*(\frac{1}{7})^n*2^{n-1}$$
2. Pull a $7$ out of the bottom, making use of the fact that $(\frac{1}{7})^n = \frac{1}{7}(\frac{1}{7})^{n-1}$ 
$$ = \sum_{n=1}^\infty \frac{35}{7}(\frac{1}{7})^{n-1}* 2^{n-1} = \sum_{n = 1}^\infty \frac{35}{7}(\frac{2}{7})^{n-1} $$
3. This is now of the form $\sum_{n=1}^\infty ar^{n-1}$, so:
$$\sum_{n=1}^{\infty}35(7^{-n} * 2^{n-1}) = \dfrac{\frac{35}{7}}{1-\frac{2}{7}}$$

# Divergence Test
**If $\lim_{n \to \infty} a_n \ne 0$ then $\sum_{n=1}^\infty a_n$diverges.**

The divergence test only tells us that if the limit does not equal zero, then the series diverges. If the limit is zero, it doesn't necessarily mean the series converges.

# Alternating series test
Sometimes a series is not continually positive for the entire series, meaning most tests on series do not apply. To get around this, you can split the series into two or more parts. A finite negative number + infinity is still infinity, and a finite negative number + a finite number is still a finite number.

A simple example of an alternating series is:
$$ \sum_{n=1}^\infty (-1)^{n+1}a_n = a_1 - a_2 + a_3 - a_4 $$
The above series converges if all three of the following hold true:
- $a_n > 0$
- Series decreases: $a_n \ge a_{n+1}$  for all $n$
- $\lim_{n\to\infty} a_n = 0$ as_
This test does not provide any guarantees about divergence i.e if if the test fails, the series does not necessarily diverge.

A sequence $a_n$ *converges absolutely* if $\sum |a_n|$ converges

Then if the *series converges* absolutely then the sum converges.

## Examples
> Does the series $\sum_{n=1}^\infty (\frac{(-1)^n}{n^2}$  conditionally converge, absolutely converge, or diverge?
1. $\sum_{n=1}^\infty|\frac{(-1)^n}{n^2}| = \sum_{n=1}^\infty \frac{1}{n^2}$ 
2. We know that $\sum_{n=1}^\infty \frac{1}{n^2}$ converges by the p test, so the series absolutely converges.

> Does the series $\sum_{n=1}^\infty (\frac{(-1)^n}{n+5}$  conditionally converge, absolutely converge, or diverge?
1. Consider $\sum_{n=1}^\infty|\frac{(-1)^n}{n+5}| = \sum_{n=1}^\infty \frac{1}{n+5}$.
2. The above series can be compared to $\frac{1}{n}$ with the limit comparison test. $\lim_{n \to \infty}\dfrac{\frac{1}{n}}{\frac{1}{n+5}} = 1 \ne 0, \infty$. By the L.C.T, $\frac{1}{n+5}$ diverges, so the series does not absolutely converge.
3. Applying the Alternating Series Test,
	- $a_n > 0$ for all $n$ - all values in the series are greater than zero
	- $a_n \ge a_{n+1}$ - the series decreases
	- $\lim_{n \to \infty} a_n = 0$ - the series approaches zero
All three conditions hold true, therefore we know that $\sum_{n=1}^\infty \frac{(-1)^n}{n+5}$ conditionally converges.

## Error
Let $\sum_{n=1}^\infty (-1)^n a_n$ be a series shown to converge by the alternating series test, and that it converges to a $L$. Then the remainder for a given term $N$ is $R_N = L - S_N$ . So $|R_N| \le a_{N+1}$. 

The error for the first $n$ terms of a sequence is less than or equal to the $(n + 1)$ st term of the sequence. 

# Power Series
A power series centered at $c$ is a series of the form:
$$ \sum_{n=0}^\infty a_n(x-c)^n = a_0 + a_1(x-c) + a_2(x-c)^2 + \cdots$$
where $x$ is a variable.

$\sum x^n$ converges when $|x| < 1$  and diverges when $|x| \ge 1$. 

The above series is a power series where $a_n = 1$  and $c = 0$.

## Behavior
The behavior a given power series falls into one of three cases:
1. The series converges on an interval with radius $R > 0$ When this happens, each interval endpoint needs to be checked independently, because the ratio test will always be indeterminate at those points.
2. The series converges for all $x = \mathbb{R}$
3. The series will converge at a single point, $c$. 

# Examples
> When does the series $\sum_{n=0}^\infty \frac{x^n}{3^n}$ converge?
1.  Solving for any power series usually starts with the ratio test.
		1. Create a ratio with $n + 1$ and $n$. 
		$$ \frac{x^{n+1}}{3^{n+1}} \cdot \frac{3^n}{x^n} $$
		2. Cancel stuff out
		$$ \frac{x}{3}$$
2. For a geometric series, it converges when the ratio $r$ is less than one. Written as an equality, this gives us:
$$ |r| < 1 \to |\frac{x}{3}| < 1 \to |x| < 3 $$
This means that the interval of convergence is $(-3, 3)$, given it diverges at both interval endpoints.