Math Concepts Review For Algorithm Analysis

Exponents

Exponents overview

An exponent is a way of expressing repeated multiplication. Consider an expression like \(a^n\), where \(a\) is the base and \(n\) is the exponent. It signifies multiplying \(a\) by itself \(n\) times. Mathematically, it can be written as:

\[a^n = \underbrace{a \times a \times a \times \ldots \times a}_{n \text{ times}}\]

For example, \(2^3\) means \(2\) raised to the power of \(3\), which is \(2 \times 2 \times 2 = 8\). Exponents can be integers, fractions, decimals, or even negative numbers.

Properties

  • Product Rule: \(a^{m+n} = a^m \times a^n\)

  • Quotient Rule: \(a^{m-n} = \frac{a^m}{a^n}\)

  • Power Rule: \((a^m)^n = a^{m \cdot n}\)

  • Negative Exponent Rule: \(a^{-n} = \frac{1}{a^n}\)

  • Zero Exponent Rule: \(a^0 = 1\)

Scientific Notation

Exponents are used to represent very large or very small numbers in a concise form, known as scientific notation. It’s written as \(a \times 10^n\), where \(a\) is a number between 1 and 10, and \(n\) is an integer. For example, \(6.022 \times 10^{23}\) represents Avogadro’s number in chemistry.

Logarithm

Logarithm overview

A logarithm is the inverse operation of exponentiation. It helps you solve for the exponent in an equation like \(a^x = b\). In other words, if you have \(2^x = 8\), the logarithm base 2 of 8 is 3 (written as \(\log_2(8) = 3\)). Logarithms are used to simplify complex calculations, especially in fields like science and engineering.

The logarithm base \(b\) of a number \(x\) is denoted as \(\log_b(x)\). The base \(b\) is usually chosen to be a positive number greater than 1, but not equal to 1.

Properties

  • Logarithmic Identity: \(\log_b(b^x) = x\)

  • Exponential Identity: \(b^{\log_b(x)} = x\)

  • Product Rule: \(\log_b(xy) = \log_b(x) + \log_b(y)\)

  • Quotient Rule: \(\log_b\left(\frac{x}{y}\right) = \log_b(x) - \log_b(y)\)

  • Power Rule: \(\log_b(x^n) = n \cdot \log_b(x)\)

Series

In mathematics, a series refers to the sum of the terms in a sequence. A sequence is an ordered list of numbers or other mathematical objects, while a series is the result of adding these terms together in a specific order. Series play a fundamental role in various mathematical disciplines and have applications in numerous real-world scenarios, ranging from physics and engineering to finance and computer science.

Mathematically, a series can be denoted as follows:

\[a_1 + a_2 + a_3 + \ldots + a_n + \ldots\]
  • \(a_1, a_2, a_3, \ldots\) are the terms of the sequence.

  • \(n\) represents the position of the term in the sequence.

  • The ellipsis \(\ldots\) indicates that the sequence continues indefinitely.

Series can be classified into various types based on the behavior of their terms. Two common types are arithmetic series and geometric series:

Arithmetic Series

In an arithmetic series, each term is obtained by adding a constant difference to the previous term. For example, 2, 5, 8, 11, … is an arithmetic series with a common difference of 3.

The sum of the first \(n\) terms of an arithmetic series can be calculated using the formula:

\[S_n = \frac{n}{2} \cdot (2a + (n-1)d)\]

where:

  • \(n\) is the number of terms,

  • \(a\) is the first term, and

  • \(d\) is the common difference between terms.

Geometric Series

In a geometric series, each term is obtained by multiplying the previous term by a constant ratio. For example, 3, 6, 12, 24, … is a geometric series with a common ratio of 2.

The sum of the first :math`n` terms of a geometric series can be calculated using the formula:

\[S_n = \frac{a \cdot (1 - r^n)}{1 - r}\]

where:

  • \(a\) is the first term,

  • \(r\) is the common ratio between terms, and

  • \(n\) is the number of terms.

Applications in Computer Science

In computer science, series are used to analyze the complexity of algorithms. For example, the time complexity of an algorithm can be expressed as a series, where each term represents the time taken by the algorithm at a particular step. The sum of the series gives the total time taken by the algorithm to complete its execution.

For example:

In a selection sort algorithm, the time taken to find the minimum element in the unsorted part of the array is \(n + (n-1) + (n-2) + \ldots + 1\), where \(n\) is the size of the array. This is an arithmetic series with a common difference of 1. The sum of the series is \(\frac{n(n+1)}{2}\), which is the time complexity of the selection sort algorithm.

Modular Arithmetic

Modular arithmetic is a mathematical concept that deals with remainders when one integer is divided by another. It’s a unique arithmetic system with applications in various fields, including number theory, cryptography, computer science, and more.

The Modulus Operation

In modular arithmetic, we work with a fixed positive integer called the modulus, often denoted as \(m\). When you perform a modulus operation (denoted by \(mod\)) on an integer \(a\) with respect to \(m\), you’re essentially finding the remainder when \(a\) is divided by \(m\).

For example:

  • \(15 \mod 7\) yields a remainder of 1 because \(15\) divided by \(7\) leaves a remainder of \(1\).

  • \(23 \mod 5\) gives a remainder of 3, as \(23\) divided by \(5\) has a remainder of \(3\).

Congruence

A fundamental concept in modular arithmetic is congruence, denoted as \(a \equiv b \pmod{m}\). This means that \(a\) and \(b\) have the same remainder when divided by \(m\). In other words, \(a\) and \(b\) are equivalent in the modular arithmetic sense with respect to \(m\).

For example:

  • \(17 \equiv 3 \pmod{7}\) because both \(17\) and \(3\) leave a remainder of \(3\) when divided by \(7\).

Applications in Computer Science

In programming, modular arithmetic is useful for tasks like array indexing (circular buffers), random number generation, and hashing.

Proof methods

In mathematics, a proof is a logical argument that establishes the truth of a statement. It’s a way of showing that a mathematical statement is true based on an established set of axioms and inference rules. Proofs are essential to the development of mathematics because they convey mathematical knowledge with certainty.

There are various methods of proof that can be used to establish the validity of a mathematical statement. Some of the most common methods are:

Direct proof

A direct proof is like building a bridge between two islands. Imagine you want to show that if “A” is true, then “B” must also be true. You start by assuming that “A” is true and then logically follow the steps, like stepping on stones in a river, to show how “B” must also be true. It’s like a straightforward path that connects the two points. For example, if you want to prove that “If a number is even, then its square is also even,” you would start by assuming that a number is even, then show how its square being even logically follows.

\(A \Rightarrow B \quad \text{by assuming} \quad A \quad \text{and demonstrating} \quad B.\)

Proof by contradiction

This method is a bit like being a detective. Imagine you’re trying to prove that “A” is true. Instead of directly showing it, you assume the opposite - that “A” is false. Then, you investigate and follow the evidence to see where it leads. If this assumption leads to a contradiction, something that just doesn’t make sense, then you know your assumption must be wrong, and therefore, “A” must be true. It’s like assuming a suspect is innocent, finding contradictions in their alibi, and realizing they must be guilty. For instance, to prove that “The square root of 2 is irrational,” you would assume it’s rational (can be expressed as a fraction), follow the logic, and eventually encounter something that doesn’t make sense, leading to the conclusion that your initial assumption is incorrect.

\(\text{Proof by contradiction assumes} \quad \neg A \quad \text{and derives a contradiction, implying} \quad A.\)

Proof by induction

Think of this method as building a tall tower with blocks. Imagine you want to prove something for all the floors of the tower. You start by showing that the first floor is true (this is the base case). Then, you show that if one floor is true, the next floor above it is also true (this is the inductive step). If you can keep adding one block at a time and never run out, you can be sure that the tower is infinitely tall. This is used to prove statements about whole numbers, like showing that the sum of the first “n” positive integers is n(n+1)/2.

\(\text{Proof by induction involves base case} \quad (n = 1) \quad \text{and inductive step} \quad (k \Rightarrow k+1) \quad \text{to prove statement for all} \quad n.\)

Proof by contrapositive

This method is like using a backdoor to prove something. Imagine you want to prove that “If A is true, then B must be true.” Instead of proving it directly, you prove the contrapositive statement: “If B is not true, then A cannot be true.” It’s like saying, “If it’s not raining, the ground cannot be wet.” If you can show that when B is false, A must also be false, then it indirectly shows that when A is true, B must be true. For example, to prove that “If a number squared is even, then the number itself is even,” you would prove that if the number is not even, its square cannot be even either.

\(\text{Proof by contrapositive shows} \quad A \Rightarrow B \quad \text{by proving} \quad \neg B \Rightarrow \neg A, \quad \text{its logical equivalent.}\)