Machine Learning
Understanding Mathematics in Machine Learning : Math Made Simple
A beginner-friendly guide to the four essential mathematical foundations of Machine Learning.

From school to college and even now, most of us have asked or thought the same question at least once:
“Where am I ever going to use all this sin θ, cos θ, and everything else in real life?”
Back then, math felt like something that only existed inside textbooks and exams — abstract, repetitive, and far away from anything practical. But, the funny thing is that math has been everywhere all along in our daily lives, from measuring ingredients while cooking, every Google Maps we follow, to every recommendation Netflix makes — we have Mathematics hidden behind everything. In this context, Machine Learning is no exception.
NOTE: Assuming that you already know what machine learning is and how models are trained. This article focuses on the math that secretly powers it — in a way that actually makes sense.
So, let’s begin…
Why Math Matters in Machine Learning (ML)?
Machine learning (ML) is not just about building models or coding; it involves a lot of critical thinking, experimenting, and learning from trials and errors.
In every project, Math helps models:
Represent and process data
Learn from mistakes
Handle uncertainty
Evaluate results

Let’s see how each of these concepts of math quietly shapes what ML can do, using some real-world examples you’ll actually relate to.
Linear Algebra
As you might know, machines can understand only a certain language, like numbers. Whether you want to deal with images, texts, or user data, machines can learn only in numbers. We are using Linear Algebra to do this.
Now, let’s take the example of Spotify recommending songs that interest you. Each song will be represented as a vector — numbers that capture the tempo, rhythm, energy, etc. Similarly, you are represented as another vector, which has your listening history and your mood preferences.

Your listening preference (based on previously liked songs),
Listener = [100,0.85,0.9]
This means you (the listener) like moderately fast, energetic, and very danceable songs.
Spotify compares these vectors using mathematical operations (like dot products and cosine similarity) to find songs closest to your taste. The system compares your (listener) vector with each song's vectors using cosine similarity ( to measure how closely aligned the song is with your taste ).
High similarity → the song will be recommended to you
Low similarity → song is less likely to be recommended
But Linear Algebra doesn’t stop there.
When we have huge amounts of data — like millions of songs and listeners — it gets too complex to analyze every single detail.
So, we will be using a concept in Linear Algebra called Eigenvalues and Eigenvectors.
They help us simplify the data.
You might be wondering, “If we simplify the data, won’t we lose some of the information which are valuable?”
Surprisingly, no — this method reduces the complexity and keeps important information.

Let’s think of Spotify again. Say, suppose we have thousands of features involved in our data, like tempo, energy, etc. You, as a listener will also have these thousand features for each song you listen to. So, instead of analyzing tiny details of each feature Spotify uses PCA — Principal Component Analysis which is based on Eigenvalues and Eigenvectors to capture the important information. In our example, as you like moderately fast, energetic, and very danceable songs. Only those features will be chosen.
Calculus
Once the data is represented as numbers that a machine can understand, the next goal of the ML model is to learn patterns — to make smarter and more accurate predictions. But learning always involves making mistakes and figuring out how to fix them. We are using concepts like derivatives and gradients in Calculus to do this.
Now, let’s take an example of a food delivery app like Swiggy or Zomato trying to predict delivery times. The ML model predicts 25 minutes, but the actual delivery takes 30 minutes.
That 5-minute difference is an error — and the model needs to fix it.
So, using Calculus, the model checks how each factor — like distance, traffic, and weather — contributes to that error.
Then, it slightly tweaks its internal settings (called weights) to reduce that mistake next time.
This step-by-step approach of learning from mistakes and correcting is called Gradient Descent.

As you can see, Calculus helps the model figure out which direction to adjust and by how much so that its next prediction is closer to the correct answer.
In simple terms, calculus is what allows a machine to learn from its errors and keep getting smarter over time just like how we do when we practice something and get better each time..
Probability
We just saw how Calculus helps a model learn from its mistakes and move closer to the right answer/predictions by reducing the error.
But we can all imagine how messy the real world is. Data in the real world isn’t as clean or simple as anyone thinks. It can have misspelled words, express sarcasm, slang — things that can confuse machines.
For this very reason, making perfectly accurate predictions is more of a dream than a reality. We’ll use Probability Theory to do this. So, ML models need not just make exact decisions, but they can also make probabilistic guesses.
Now, let’s take an example of our Gmail inbox. Every day, it filters hundreds of our emails — some are important, others are spam.
When Gmail marks an email as spam, it cannot be 100% sure.
It doesn’t say, “This is spam, I’m sure about it.”
Instead, it says something like:
“There’s a 95% chance this is spam.”
The 95% is what we call Probability. It helps the model measure the confidence in its decision.
If the email contains too many promotional words like “Free” or “Win now!”, the model’s confidence increases and returns the mail as spam.
But, if the sender is someone you’ve interacted with before, the probability might drop to 60%, so Gmail decides it’s probably safe.

This way, the system balances between:
False alarms (good emails marked as spam)
Missed detections (spam that sneaks into your inbox)
Without probability, the model would treat every decision as 0 or 1 — spam or not spam — and that would fail badly, as Real-world data is never perfect.
Statistics
So, we’ve built the ML model. It’s trained, it’s running, and it’s making predictions. But we didn't talk about Statistics anywhere, which is involved in each ML stage. From raw data, cleaning and understanding the data, final predictions, to testing the results, we use Statistics in all these stages.
Statistics is the backbone of Machine Learning.

Understanding the Data
Concepts: Mean, median, mode, variance, standard deviation, correlation, distributions.
These help us explore data, find patterns, and detect outliers.
Example: Checking if income and spending have a strong correlation before predicting loan defaults.
Preparing and Improving Features
Concepts: Normalization, standardization, sampling, z-scores.
These ensure data is clean, balanced, and ready for training.
Example: Using z-scores to handle outliers or scale numerical features.Model Building
Concepts: Probability distributions, hypothesis testing, Maximum Likelihood Estimation (MLE), Bayesian inference.
Many algorithms — like logistic regression and Naive Bayes — rely on these principles to estimate relationships and probabilities.Model Evaluation
Concepts: Confusion matrix, precision, recall, F1-score, ROC curve, AUC.
These statistical tools measure how well a model performs.
Example: Evaluating how many spam emails were correctly detected.Validation and Fairness
Concepts: Cross-validation, confidence intervals, bias–variance tradeoff, statistical significance tests.
These ensure the model is reliable, unbiased, and generalizes well to new data.
In a Nutshell
Linear Algebra— it shapes raw data into forms machines can understand.
Calculus — it drives how models learn and improve from their mistakes.
Probability — it helps models handle uncertainty and make informed predictions.
Statistics — it validates and measures how well our models truly perform.
Together, these mathematical ideas are what turn our raw data into meaningful insights, predictions, and Human-like intelligence.
NOTE: This article is meant to give a basic understanding of how math is used in Machine Learning. Each of these concepts is deep, so I’ll be covering them in detail in upcoming articles.
Mathematics in ML is vast — and it deserves more than just one blog.


