Sequent Sum
Computing and Data Science
Sequence
A sequence is an ordered list.
It can be finite or infinite.
Sequence
A sequence is an ordered list.
\[ 0, 1, 2, 3, 4, 5, 6, ...\]
\[0, -0.1, -0.001, -0.0001 \]
\[ 1, 4, 9, 16, 25, 36 \]
\[ \frac{1}{3},\frac{2}{5},\frac{3}{7},\frac{4}{9}, ...\]
\[ 1, 4, 1, 5, 9, 2, 6, 5, ... \]
\[5, 10, 15, 20, 25, ...\]
\[5, 10, 15, 20, 25, ...\]
\[ a_1, a_2, a_3, a_4, a_5, ... \]
Formulating a Sequence
\[5, 10, 15, 20, 25, ...\]
Explicit Formula
\[a_n = 5n\]
\[n \geq 1\]
Formulating a Sequence
\[5, 10, 15, 20, 25, ...\]
Recursive Definition
\[a_1 = 5\]
\[a_n = a_{n-1} + 5\]
Exercise
Find both an explicit and recursive definition for the sequence: \[ 8, 11, 14, 17, ... \]
Exercise
Find both an explicit and recursive definition for the sequence: \[ 8, 11, 14, 17, ... \]
\[a_n = 8+3n, \quad \quad n \geq 0 \]
Exercise
Find both an explicit and recursive definition for the sequence: \[ 8, 11, 14, 17, ... \]
\[a_n = 8+3n, \quad \quad n \geq 0 \]
\[ a_1 = 8, \quad \quad a_{n+1} = a_n + 3 \]
Some famous sequences
| \(2,4,6,8,10, ...\) |
The even numbers. The sequence \(e_n\) has
closed formula \(e_n = 2n\) |
| \(1,4,9,16,25, ...\) |
The square numbers. The sequence \(s_n\) has
closed formula \(s_n = n^2\) |
| \(1,3,6,10,15,21, ...\) |
The triangular numbers. The sequence \(T_n\) has
closed formula \(T_n = \frac{n(n+1)}{2} \) |
| \(1,2,4,8,16,32, ...\) |
The powers of 2. The sequence \(a_n\) has closed
formula \(a_n = 2^n\) |
| \(1,1,2,3,5,8,13, ...\) |
The Fibonacci numbers are defined recursively by
\(F_1=F_2=1\),
\(F_{n} = F_{n-1}+F_{n-2}\) |
Sequence Behavior
A sequence converges
if \(a_n\) approaches a single value as \(n \to \infty\)
\[ 3.9, 3.99, 3.999, 3.9999, ... \]
Sequence Behavior
A sequence converges
if \(a_n\) approaches a single value as \(n \to \infty\)
\[ 3.9, 3.99, 3.999, 3.9999, ... \]
\[ \lim_{n \to \infty} a_n = 4 \]
Sequence Behavior
A sequence diverges
if it does not converge
\[ 1, 2, 4, 8, 16, ... \]
Sequence Behavior
A cycle occurs when a sequence
oscillates between two or more values.
\[ 4, 2, 1, 4, 2, 1, 4, ... \]
Sequence Behavior Summary
| Converge |
Approach a single value |
| Diverge |
Does not converge |
| Cycle |
Oscillate between two or more values (special case of divergence) |
Sums
There are many applications where
we will sum a sequence.
\[ 1, 2, 4, 8, 16, 32, ... \]
Sums
There are many applications where
we will sum a sequence.
\[ 1, 2, 4, 8, 16, 32, ... \]
\[ 1 + 2 + 4 + 8 + 16 + 32 + ... \]
\(\Sigma\)-notation
\[ 1 + 2 + 4 + 8 + 16 + 32 + ... \]
\[ \sum_{n=0}^{\infty} 2^n \]
\(\Sigma\)-notation
\[ 1 + 2 + 4 + 8 + 16 + 32 + ... \]
\[ \sum_{n=0}^{\infty} 2^n = 2^{(0)} + 2^{(1)} + 2^{(2)} + 2^{(3)} + ... \]
\(\Sigma\)-notation
\[ \frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \frac{1}{16} + ... \]
\[ \sum_{n=1}^{\infty} \frac{1}{2^n} = \frac{1}{ 2^{(1)}} + \frac{1}{ 2^{(2)}} + \frac{1}{ 2^{(3)}} + ... \]
Why summation notation?
It is a compact notation for repeated sums.
Consider calculating the mean of a large dataset:
\(x = 5.2, \quad 3.8, \quad 4.2, \quad 3.7, \quad 6.8, ... \)
Consider calculating the mean of a large dataset:
\[\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i\]
| Mean |
\(\bar{x} = \frac{1}{n} \sum_{i=1}^n x_i\) |
| Sum of Squared Errors |
\(SSE = \sum_{i=1}^n (x_i - \bar{x})^2\) |
| Variance |
\(\sigma^2 = \frac{1}{n} \sum_{i=1}^n (x_i - \bar{x})^2\) |
| Standard Deviation |
\(\sigma = \sqrt{\frac{1}{n} \sum_{i=1}^n (x_i - \bar{x})^2}\) |
| Covariance |
\(\text{Cov}(X, Y) = \frac{1}{n} \sum_{i=1}^n (x_i - \bar{x})(y_i - \bar{y})\) |
| Correlation |
\(r = \frac{\sum_{i=1}^n (x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum_{i=1}^n (x_i - \bar{x})^2} \, \sqrt{\sum_{i=1}^n (y_i - \bar{y})^2}}\) |
| Expected Value |
\(E[X] = \sum_{i=1}^n x_i p_i\) |
\(\Sigma\) Examples
\[\sum_{x=4}^{6}3x^2 = 3(4)^2 + 3(5)^2 + 3(6)^2 \]
\(\Sigma\) Examples
\[\sum_{k=1}^{3} \left( 5k+2 \right) = \]
\[ \left[ 5(1)+2 \right] + \left[ 5(2)+2 \right] + \left[ 5(3)+2 \right] \]
Exercise
Expand \[\sum_{k=2}^{5} (3+k)^{k-2} \]
Exercise
Expand \[\sum_{k=2}^{5} (3+k)^{k-2} \]
\[\sum_{k=2}^{5} (3+k)^{k-2} = (3+2)^{(2-2)} + (3+3)^{(3-2)} + (3+4)^{(4-2)} + (3+5)^{(5-2)} \]
Exercise
Expand \[\sum_{k=2}^{5} (3+k)^{k-2} \]
\[\sum_{k=2}^{5} (3+k)^{k-2} = 5^{0} + 6^{1} + 7^{2} + 8^{3} \]
\[\sum_{k=2}^{5} (3+k)^{k-2} = 568 \]