# Unit 2: Sequences, Series, and Finicial Applications ## Terms **sequence**: is an ordered set of numbres. **Arithmetic Sequences**: is a sequence where the difference between each term is constant, and the constant is known as the `common difference`. **Geometric Sequences**: is a sequence in which the ratio between each term is constant, and the constant is known as the `common ratio`. **Note:** Not all sequences are arithmetic and geometric! **finite series**: finite series have a **finite** number of terms. - eg. $`1 + 2 + 3 + \cdots + 10`$. **infinite series**: infinite series have **infinite** number of terms. - eg. $`1 + 2 + 3 + \cdots`$ Terms in a sequence are numbered with subscripts: $~t_1, t_2, t_3, \cdots t_n`$ where $`t_n`$is the general or $`n^{th}`$ term. **Series**: A series is the sum of the terms of a sequence. ## Recursion Formula A sequence is defined recursively if you have to calculate a term in a sequence from previous terms. The recursion formula consist of 2 parts. 1. Base term(s) 2. A formula to calculate each successive term. eg. $`t_1 = 1, t_n = t_{n-1} + 1 \text{ for } n \gt 1`$ ## Aritmetic Sequences Basically, you add the **commmon difference** to the current term to get the next term. As such, it follows the following pattern: $`a, a+d, a+2d, a+3d, a+4d, \cdots`$. Where $`a`$ is the first term and $`d`$ is the **common difference**. As such, the general term of the aritmetic sequence is: $`\large t_n = a + (n - 1)d`$ ## Geoemetric Sequences Basically, you multiply by the **common ratio** to the current term toget the next term. As such, it follows the following pattern: $`a, ar, ar^2, ar^3, ar^4, c\dots`$. Where $`a`$ is the first term and $`r`$ is the **common ratio**. As such, the general term of the geometric sequence is: $`\large t_n = a(r)^{n-1}`$ ## Aritmetic Series An arithmetic series is the sum of the aritmetic sequence's terms. The formula to calculate is: $`\large S_n = \dfrac{n(a_1 + a_n)}{2}`$ Or $`\large S_n = \dfrac{n(2a_1 + (n-1)d)}{2}`$ ## Geometric Series - A geoemtric series is created by adding the terms of the geometric sequence. The formula to calulate the series is: $`\large S_n= \dfrac{a(r^n- 1)}{r-1}`$ or $`\large S_n = \dfrac{a(1 - r^n)}{1 - r}`$ ## Series and Sigma Notation Its often convient to write summation of sequences using sigma notation. In greek, sigma means to sum. eg. $`S_ = u_1 + u_2 + u_3 + u_4 + \cdots + u_n = \sum_{i=1}^{n}u_i`$ $`\sum_{i=1}^{n}u_i`$ means to add all the terms of $`u_i`$ from $`i=1`$ to $`i=n`$. Programmers might refer to this as the `for` loop. ```cpp int sum=0; for(int i=1; i<=N; i++) { sum += u[i]; } ```