Udemy | Introductory Programming Course | Math Prerequisite

Functions and Logarithms

Prerequisites for Programming and Algorithms

Kaivalya Vanguri
3 min readAug 13, 2024

If you have not visited the sets and Relations concept, please go through them to brush up on terms and mathematical phrases that we would be using here.

Image by Author

Functions are a special type of relation where

input set and output set are non-empty

each element of the first set or input set has precisely one output from the second set.

f(a) = b where a ∈ A (input set/domain) and b ∈ B output set/co-domain)

Domain refers to the input set and codomain refers to the output set.

There are many different types of Functions but the ones that are of utmost importance are:

  • One-one Function (Injective Function)
Image by Author
  • Many-one Function
Image by Author
  • Onto Function (Surjective Function)
Image by Author
  • Into Function
Image by Author
  • Modulus Function
Image By Author
  • Signum Function
Image By Author
  • Greatest Integer Function
Image By Author
  • Fractional Part Function
Image by Author
  • Even and Odd Function
Image By Author
  • Periodic Function
Image by Author
  • Constant Function (x=k or y = k where k is a constant)
Image by Author
  • Identity Function (y=x)
Image by Author

Logarithms:

To understand logarithms, you need to ask yourself the question,

what exponent is required to achieve the output for a certain base?

we know that 2 × 2 × 2 × 2 × 2 = 32 then what would be? here

2^? = 32 (2 is the base and 32 is the product)

Logarithms/Logs answer this question. Hence Logarithms are a special type of function that finds the exponent from the base and product. They are also known as the inverse of exponentiation. In exponentiation you find the product and in logs you need to find the exponent.

log2(32) = x -> log2(32) = 5

You also need to learn about the natural number e.

e = 2.718 (Euler’s Number)

Here is a logarithmic graph of base e with horizontal and vertical assymptotes.

Image by Author

Logarithms have several useful properties.

A few of the main ones are here:

Product Rule: log a (mn) = log a (m) + log a (n)

Quotient Rule: log a (m/n) = log a (m) — log a (n)

Power Rule: log a (m)^n = n × log a (m)

Change Of Base Rule: log n (m) = log p (m)/ log p (n)

Reciprocal Rule: log n (m) = 1 / log m (n)

Hope this cleared the basics of Functions and Logarithms. In the next article I will be covering more on Counting and Probability.

--

--