← Back
CSNotes

SEQUENCE:

A sequence is a function from a subset of integers to a set SS. We use the notation ana_n to denote the image of the integer nn. We call ana_n a term of sequence

Doing an example will help

Examples:

If an=2na_n=2n, find {an}\lbrace a_n \rbrace

  • We typically start from n=0n=0, so we would get:

    • a0=2(0)=0a_0=2(0)=0
    • a1=2(1)=2a_1=2(1)=2
    • a2=2(2)=4a_2=2(2)=4
    • a3=2(3)=6a_3=2(3)=6
  • So, since we are asked to find the set of values that create the sequence, we would get

    an={0,2,4,6,… }a_n=\lbrace 0,2,4,6,\dots \rbrace

Consider the sequence {an}\lbrace a_n \rbrace where an=n2+n+41a_n=n^2+n+41, Find the first five elements of this sequence

  • ana_n goes on to infinity and starts at zero, we denote this by {an}n=0∞\lbrace a_n \rbrace^{\infty}_{n=0}.
  • The first 5 elements, starting from zero would be:
    • a0=(0)2+0+41=41a_0=(0)^2+0+41=41
    • a1=43; a2=47; a3=54; a4=61a_1=43; \ a_2=47; \ a_3=54;\ a_4=61
    • So, our sequence would look something like an={41,43,47,54,61,… }a_n=\lbrace 41,43,47,54,61,\dots \rbrace

Sequences of the form a1,a2,...,ana_1,a_2,...,a_n are often used in cs. These finite sequences are what we call strings

ARITHMETIC PROGRESSION:

An arithmetic progression is a sequence of the form

a,a+d,a+2d,a+3d,…,a+nda,a+d,a+2d,a+3d,\dots,a+nd

where the initial term aa and the common difference dd are REAL NUMBERS.

So, an=a+(n−1)da_n=a+(n-1)d

Example:

If we are given a5=10a_5=10 and a10=20a_{10}=20, what is the value of a20a_{20}?

GEOMETRIC PROGRESSION:

A geometric progression is a sequence of the form

a,ar,ar2,...,arna,ar,ar^2,...,ar^n

where the initial term aa and the common ratio rr are REAL NUMBERS

So, an=arn−1a_n=ar^{n-1}

Example:

{an}\lbrace a_n \rbrace is a geometric progression. If we are given that a2=8, a5=64a_2=8,\ a_5=64, find a10a_{10}

RECURSIVELY DEFINED SEQUENCES:

A recurrence relation for the sequence {an}\lbrace a_n \rbrace is an equation that expresses ana_n in terms of one or more of the previous terms of the sequence, namely a0,a1,…,an−1a_0,a_1,\dots,a_{n-1}, for all integers n,n≥n0n,n\ge n_0, and n0n_0 is a nonnegative number. In simpler terms, a recursive sequence is a sequence in which terms are defined using one or more previous terms along with the initial condition.

The most common recurrence formula is the Fibonacci sequence. The Fibonacci sequence, f0,f1,f2,…f_0,f_1,f_2,\dots is defined by the initial conditions (or base cases) f0=0f_0=0 and f1=1f_1=1 and the recurrence relation

fn=fn−1+fn−2f_n=f_{n-1}+f_{n-2}

So, for example, if we wanted to find f7f_7, it would look something like this:

CLOSED FORMULA:

While recursive formulas can come in handy, sometimes they can be a pain in the ass. So, if we take the Fibonacci sequence again, what if we wanted to find f100f_{100}? That is gonna be ridiculous to find, because they requires us to find all the terms before the 100th term, which is a LOT of work.

So, we want to find a non-recursive formula to calculate ana_n is called solving the recurrence relation. The solution is called a closed formula

Example:

Let {an}\lbrace a_n \rbrace be a sequence such that a1=1a_1=1 and an=an−1+na_n=a_{n-1}+n. Find the closed formula for ana_n

It is important to note that not all recursive methods have closed formulas

SUMMATION:

Instead of writing a1+a2+...+ana_1+a_2+...+a_n, we can write ∑i=1nai\sum_{i=1}^{n} a_i, so this starts from a1a_1 all the way to ana_n, adding them all together

We also have if you recursively multiply numbers together, there is a symbol for this:

∏i=1nai=a1×a2×...×an\prod_{i=1}^{n}a_i=a_1\times a_2\times...\times a_n

Example:

  1. Find ∑i=15i\sum_{i=1}^{5}i

This is just 1+2+3+4+5=15

  1. Find ∑i=15(i2+i+1)\sum_{i=1}^{5}(i^2+i+1)

This is equal to:

(12+1+1)+(22+2+1)+(32+3+1)+(42+4+1)+(52+5+1)=75(1^2+1+1)+(2^2+2+1)+(3^2+3+1)+(4^2+4+1)+(5^2+5+1)=75, do the math you can figure it out

  1. Write 25+26+...+220232^5+2^6+...+2^{2023} as a sigma notation

∑i=520232i\sum_{i=5}^{2023}2^i. Which can also be written as ∑i=020182i+5\sum_{i=0}^{2018}2^{i+5}

The most important ones you should know would be these:

first column is sum the second column is closed formula