avatarDr. Ashish Bamania

Summary

This context provides an overview of mathematical concepts relevant to programming, focusing on sets, Venn diagrams, prime numbers, Riemann hypothesis, probability, and calculus.

Abstract

The article "50 Mathematical Concepts For Better Programming (Part 1)" discusses various mathematical concepts essential for programming, starting with sets and their notations, such as null sets, universal sets, and complements. It explains the use of Venn diagrams for visualizing set operations, including intersections and unions. The article further delves into prime numbers, the Riemann hypothesis, and its potential impact on predicting the distribution of prime numbers. It also covers probability theory, rules of probability, and calculus, with a focus on differentiation and integration.

Opinions

  • The author believes that understanding mathematical concepts is crucial for better programming.
  • The author presents the Riemann hypothesis as a significant unsolved problem in mathematics.
  • The author provides a practical example of using probability to calculate the likelihood of an event occurrence.
  • The author emphasizes the importance of calculus in dealing with continuously changing quantities and calculating gradients, smallest and largest values of functions, areas, and volumes.

50 Mathematical Concepts For Better Programming (Part 1)

Image by storyset on Freepik

Check out my books below:

1. Sets

Sets are collections of objects.

Georg Cantor, a German mathematician initiated the development of set theory.

A set is mathematically represented by items inside curly braces ({}).

For example:

  • a set of natural numbers (N): {1, 2, 3, … ∞}
  • a set of whole numbers : {0,1, 2, 3, … ∞}
  • a set of integers (Z) : {-∞,… 0,1, 2, 3, … ∞}
  • a set of rational numbers: numbers that can be represented as a ratio of two integers. For example : {…, 5/2, 4/3, 0.76,...}
  • a set of irrational numbers: numbers that cannot be expressed as a ratio of two integers. For example :{…, √2, √5, π, e, …}
  • a set of real numbers (R): consisting of a set of rational and irrational numbers
  • a set of imaginary/ complex numbers ( C ): numbers represented as a+bi where a & b are real and i = √-1
  • a set of all numbers: consisting of a set of real numbers and complex numbers
Photo by Joanna Kosinska on Unsplash

Notations

  • Ø is a Null set i.e. A set that does not have any elements.
  • μ is the Universal Set i.e. the set of all the elements of all the sets which are being considered for set operations
  • A’ is the complement of a Set: A set that includes all the elements that are not part of the universal set i.e. (A’ = μ — A)
  • x A represents that x is a member of A. For example, a person (x) in a set of the population of France (A).
  • A B represents that A is a subset of B. For example, the set of the population of France (A) is a subset of the set of the population of Europe (B).
  • represents the Union of two sets i.e. the combination of all the elements of two sets into a single set
  • represents the Intersection of two sets i.e. combining the common elements of the two sets into a new set
A Set of Stamps (Photo by kevs on Unsplash)

2. Venn Diagrams

These are a scheme of representing sets and their operations diagrammatically.

Intersection of Two Sets

Intersection of two sets (A ∩ B) (Image from Wikipedia)

Union of Two Sets

Union of two sets (A ∪ B) (Image from Wikipedia)

3. Prime Numbers & Riemann Hypothesis

A Prime Number is any natural number greater than 1, that can only be divided exactly by itself or 1.

A set of Prime numbers can be represented as {2,3,5,7,11,13,17,...}.

Riemann Hypothesis

It is a hypothesis that suggests that the distribution of prime numbers can be predicted and the frequency of prime numbers is very closely related to the behavior of the Reimann Zeta function.

The Reimann Zeta Function

To be precise, this conjecture tells that the Riemann zeta function has its zeros only at:

  • the negative even integers (trivial zeros) and
  • complex numbers with real part 1/2 (non-trivial zeros)

This is one of the unsolved Millennium problems in mathematics and the first person to provide acceptable proof will be given a $1 million prize by the Clay Mathematics Institute.

4. Probability

It is a mathematical branch that deals with the likelihood of an event occurrence.

Mathematically represented by P, the probability of an event X occurring is P(X).

P (X) = Number of events where X occurs / Total number of possible outcomes

For example, the probability of getting heads in a coin toss is 1/2 or 50%.

Rules of Probability

  • The probability of an event can only be between 0 and 1.
  • If two events are independent of each other’s occurrence, then the probability of both happening is given by multiplying their individual probabilities.

P (X and Y) = P (X) * P (Y)

  • If two events are mutually exclusive, the probability of either one occurring is given by adding their individual probabilities.

P (X or Y) = P (X) + P (Y)

Photo by Alois Komenda on Unsplash

5. Calculus

It is a mathematical branch that is concerned with continuously changing quantities.

Its two major branches deal with:

  • the rate of change/ gradient of a quantity (differential calculus)
  • summation of infinitely many small quantities to calculate the whole (integral calculus)

Differentiation

It is used to calculate the gradient/ slope/ tangent of a mathematical curve.

It can also be used to find the smallest (minima) and largest value (maxima) of a function.

For a curve with an equation of y= x^n, the gradient of y with respect to x (dy/dx) is given by n * x^(n-1) .

Rules of Differentiation

  • d(n)/dx = 0
  • d(x)/dx = 1
  • d(x^n)/dx = n * x^(n-1)
  • d(e^x)/dx = e^x
  • d(ln x)/dx = 1/x
  • d(n^x)/dx = n^x * ln(x)
  • d(sin x)/dx = cos x
  • d(cos x)/dx = — sin x

Integration

It is the inverse of differentiation.

It is commonly used for calculating areas and volumes of shapes.

For an equation y = x^n , the integral of y is given by:

∫y dx = ∫ (x^n) dx = (1/n+1) * (x^n+1) + C

where C is a numerical constant.

Photo by Dan Cristian Pădureț on Unsplash

Check out the next parts in this series below:

That’s everything for this article. Thanks for reading!

Mathematics
Programming
Software Development
Software Engineering
Computer Science
Recommended from ReadMedium