Math for Machine Learning: Starting from Zero
My journey to understanding the mathematics behind Machine Learning, one concept at a time — used AI in this blog for content generation by giving prompts through my experience and dificulty for understanding math behind ML
Introduction
Have you ever wondered how a machine learns to recognize a face, recommend a movie, predict tomorrow’s weather, or generate an answer using an AI chatbot?
Behind these capabilities lies mathematics.
When I started exploring Machine Learning and Large Language Models (LLMs), I realized something important: learning the algorithms alone is not enough. To truly understand how these systems work, I need to understand the mathematics behind them.
But there is one challenge.
What if you want to learn Machine Learning but your mathematical foundations are weak? Where should you start?
That is exactly the question I want to answer through this blog series.
Instead of jumping directly into complex equations, I am starting from the basics: numbers, fractions, percentages, algebra, functions, vectors, probability, and calculus.
The goal is simple: understand the concepts first, then connect them to Machine Learning.
Let’s begin!
1. Why Does Mathematics Matter in Machine Learning?
Imagine that you want to build a system that predicts house prices.
You give the system information such as:
- The size of the house
- The number of bedrooms
- The location
- The age of the building
Based on this information, the system predicts a price.
But how does it make that prediction?
It identifies patterns in historical data, represents relationships using mathematical expressions, and adjusts its internal parameters to improve its predictions.
For example, a simple prediction model might look like this:
Predicted Price = (House Size × Weight) + Bias
Don’t worry about the words weight and bias just yet. We will understand them in later blogs.
For now, notice that the model uses multiplication and addition to calculate an answer.
That is our first important observation:
Machine Learning is not magic. Mathematics helps us understand how it works.
2. Start With Numbers
Before learning advanced mathematics, we need to understand what numbers represent.
Numbers help us describe quantities.
For example:
- 5 apples means we have five apples.
- 100 students means there are one hundred students.
- 0 means there are none of something.
- −5°C means the temperature is five degrees below zero.
Numbers are more than symbols. They allow us to represent and compare information.
This becomes important in Machine Learning because computers work with numerical representations of data.
For example, a model might represent a house using values such as:
- House size: 1,500 square feet
- Bedrooms: 3
- Age: 10 years
These numbers become inputs that a model can process.
Of course, not all real-world information starts as a number. Text, images, and audio need to be converted into suitable numerical representations before many Machine Learning models can process them.
Understanding numbers is our first step toward understanding that process.
3. Understanding Zero
Zero is one of the most important ideas in mathematics.
It represents the absence of a quantity.
If you have five apples and give all five away, how many apples remain?
The answer is zero.
[
5–5=0
]
Simple, right?
But zero also has an important role in mathematical operations.
Consider these examples:
[
0+5=5
]
[
5times0=0
]
[
0div5=0
]
However, dividing by zero is different:
[
5div0
]
This operation is undefined in ordinary arithmetic.
Why?
Division asks us to find a number that, when multiplied by the divisor, gives us the original quantity.
For example:
[
10div2=5
]
Because:
[
2times5=10
]
But for (5div0), we would need a number that satisfies:
[
0times x=5
]
No such number exists because zero multiplied by any ordinary number is always zero.
That is why division by zero is undefined.
Why does this matter for Machine Learning?
Mathematical calculations appear throughout Machine Learning algorithms. Understanding basic operations helps us recognize why certain calculations work, why others fail, and how numerical errors can occur.
4. Understanding Negative Numbers
Positive numbers represent quantities above zero, while negative numbers can represent quantities below zero or values in the opposite direction.
Consider a bank account.
If you have ₹1,000, your balance is positive:
[
+1000
]
If your account is overdrawn by ₹500, we can represent that amount as:
[
-500
]
Negative numbers are also useful for representing temperature, changes in value, and direction.
Let’s look at a simple example:
[
5–8=-3
]
Starting at 5 and subtracting 8 takes us three units below zero.
Now consider a Machine Learning example.
Suppose a model predicts a house price of ₹50 lakh, but the actual price is ₹55 lakh.
If we define the prediction error as:
[
text{Error}=text{Predicted}-text{Actual}
]
Then:
[
text{Error}=50–55=-5
]
The negative sign tells us that the model predicted a value lower than the actual price by ₹5 lakh.
If the prediction were ₹60 lakh instead, the error would be:
Get Laxman Pajjuri’s stories in your inbox
Join Medium for free to get updates from this writer.
[
60–55=+5
]
Now the model has overpredicted by ₹5 lakh.
The sign of a number can tell us not just the size of a difference, but also its direction.
5. Understanding Fractions
A fraction represents a part of a whole.
Imagine that you have a pizza divided into four equal slices.
If you eat one slice, you have eaten:
[
{1}\{4}
]
If you eat two slices, you have eaten:
[
{2}\{4}
]
And if you eat all four slices, you have eaten:
[
{4}\{4}=1
]
A fraction has two parts:
- Numerator: The number on top, representing how many parts we have.
- Denominator: The number on the bottom, representing how many equal parts make up the whole.
For example, in ({3}\{4}), the numerator is 3 and the denominator is 4.
This means we have three out of four equal parts.
Equivalent fractions
Here is something interesting.
[
{1}\{2}={2}\{4}={3}\{6}
]
How can different fractions represent the same quantity?
Imagine cutting a pizza into two equal pieces and taking one piece.
Now imagine cutting the same pizza into four equal pieces and taking two pieces.
You still have the same amount of pizza.
The number of pieces changes, but the quantity does not.
Mathematically, we can multiply the numerator and denominator by the same nonzero number without changing the value of the fraction.
For example:
[
{1}\{2}\*{2}\{2}={2}\{4}
]
Since ({2}\{2}=1), we are effectively multiplying the original fraction by 1. Its value remains unchanged.
Why fractions matter in Machine Learning
Suppose a model correctly classifies 80 out of 100 images.
Its accuracy is:
[
{Accuracy}={80}\{100}=0.8
]
This fraction can also be expressed as 80%.
We will explore decimals and percentages next.
6. Fractions, Decimals, and Percentages
These three forms may look different, but they can represent the same quantity.
Consider the following examples:
Let’s understand the relationship using one example.
Suppose 25 out of 100 students passed an examination.
The fraction is:
[
{25}\{100}
]
Dividing 25 by 100 gives us:
[
0.25
]
To convert a decimal into a percentage, multiply it by 100:
[
0.25*100=25%
]
Therefore:
[
{25}\{100}=0.25=25%
]
All three expressions describe the same quantity.
A Machine Learning example
Suppose a model makes 1,000 predictions and gets 850 correct.
Its accuracy is:
[
{850}\{1000}=0.85
]
As a percentage:
[
0.85*100=85%
]
We can say that the model has an accuracy of 85%.
This is a simple example of how fractions, decimals, and percentages help us interpret Machine Learning results.
However, accuracy alone does not tell us everything about a model’s performance. We will explore other evaluation metrics in a future blog.
7. Connecting the Basics to Machine Learning
Let’s bring these concepts together.
Imagine that you are building a simple model to predict house prices.
Your dataset contains information about several houses, including their sizes and actual prices.
You need to understand:
- Numbers to represent house measurements and prices.
- Negative numbers to understand whether predictions are above or below actual values.
- Fractions to represent parts, proportions, and ratios.
- Decimals to represent numerical values precisely.
- Percentages to understand metrics such as accuracy and percentage error.
These are not advanced Machine Learning concepts. They are the mathematical building blocks that make more advanced concepts easier to understand.
Once these foundations are clear, we can move on to algebra, variables, equations, and functions.
These concepts will help us understand how a Machine Learning model combines inputs to produce a prediction.
8. What Comes Next?
In the next blog, I will explore algebra and functions.
We will answer questions such as:
- What is a variable, and why do we use symbols such as (x) and (y)?
- What does an equation represent?
- How do we solve an equation?
- What is a function?
- What does (y=mx+b) actually mean?
- How does this simple equation connect to Machine Learning?
Instead of memorizing formulas, we will understand why they work using simple examples.
Final Thoughts
Learning mathematics for Machine Learning does not have to begin with complicated equations or advanced calculus.
It can begin with something as simple as understanding numbers, fractions, and percentages.
The key is to build one concept at a time and understand how each concept connects to the bigger picture.
I am documenting this journey to strengthen my own mathematical foundations and, hopefully, help other beginners who want to understand Machine Learning from the ground up.
You do not need to know all the mathematics before you begin. You need to be willing to learn it, one concept at a time.
This is just the beginning.
Next: Understanding Algebra and Functions — From Unknown Values to Machine Learning Predictions.
If you are also learning mathematics for Machine Learning from scratch, follow along with this series. We will start with the basics and gradually work our way toward the mathematics behind neural networks and Large Language Models (LLMs).









