← Back to list

Math for Data Science: The Only Topics You Actually Need (And Where to Learn Them for Free) 🧮

1. Statistics & Probability: The King of Data Science Math 👑

ATNO For Data Science · 2026-03-08 19:34 · 3 claps · 10.5 min read
#data-scien #math-for-data-science #data-analysis #data-visualization
Open on Medium ↗
Wiki topics: ML · Machine Learning VIS · Visual & Graphic Design 📐 · Mathematics 🔬 · Science · General

Math for Data Science: The Only Topics You Actually Need (And Where to Learn Them for Free) 🧮

1. Statistics & Probability: The King of Data Science Math 👑

If I could only learn ONE area of math for data science, it would be statistics. Hands down. No debate.

Everything in data science is about making decisions under uncertainty: and that’s literally what statistics was invented for.

1.1 Descriptive Statistics

What it is: Summarizing and describing data.

Topics you need:

  • Mean, Median, Mode: Different ways to measure the “center” of your data
  • Variance & Standard Deviation: How spread out your data is
  • Percentiles & Quartiles: Where values fall in the distribution (the 90th percentile, IQR, etc.)
  • Skewness & Kurtosis: Is your data lopsided? Does it have fat tails?
import pandas as pd

df = pd.read_csv("sales_data.csv")

# This is descriptive statistics in action
print(df["revenue"].mean())       # Central tendency
print(df["revenue"].median())     # Robust central tendency
print(df["revenue"].std())        # Spread
print(df["revenue"].quantile(0.95))  # 95th percentile

📚 Free Resources:

1.2 Probability

What it is: The math of uncertainty and chance.

Topics you need:

  • Basic probability rules: Addition rule, multiplication rule
  • Conditional probability: P(A given B). “What’s the probability a user buys, GIVEN they clicked the ad?”
  • Bayes’ Theorem: Updating beliefs with new evidence. This one’s HUGE.
  • Probability distributions:
  • Expected Value: The “average outcome” of a random process
  • Law of Large Numbers: Why bigger samples are more reliable
  • Central Limit Theorem: The most important theorem in statistics. No exaggeration.
# Bayes' Theorem in action: simple spam filter intuition
# P(spam | contains "free") = P("free" | spam) * P(spam) / P("free")

p_free_given_spam = 0.80    # 80% of spam emails contain "free"
p_spam = 0.30               # 30% of all emails are spam
p_free = 0.40               # 40% of all emails contain "free"

p_spam_given_free = (p_free_given_spam * p_spam) / p_free
print(f"P(spam | 'free') = {p_spam_given_free: .2f}")
# Output:  P(spam | 'free') = 0.60

📚 Free Resources:

1.3 Inferential Statistics

What it is: Drawing conclusions about a population from a sample.

Topics you need:

  • Sampling & sampling distributions: Why your sample might not represent reality
  • Confidence intervals: “We’re 95% confident the true value is between X and Y”
  • Hypothesis testing: Is this result real or just random noise?
  • Statistical significance vs practical significance: A tiny difference can be “statistically significant” but completely meaningless in the real world

Where you’ll use this in real life:

A/B testing. Every single tech company runs A/B tests, and this is the math behind them.

“We changed the button color from blue to green. Conversions went from 3.2% to 3.7%. Is that a real improvement or just randomness?”

That question? That’s inferential statistics.

from scipy import stats

# A/B test example:  Did the new landing page increase signups?
control = [0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0]  # 33% conversion
treatment = [1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1]  # 60% conversion

# Two: proportion z: test (simplified with t: test here)
t_stat, p_value = stats.ttest_ind(control, treatment)

print(f"p: value:  {p_value: .4f}")

if p_value < 0.05: 
    print("✅ Statistically significant! The new page works better.")
else: 
    print("❌ Not significant. Could be random variation.")

📚 Free Resources:

1.4 Regression & Correlation

What it is: Understanding relationships between variables.

Topics you need:

  • Correlation: Do two variables move together? (Pearson, Spearman)
  • Correlation ≠ Causation: The most important sentence in all of data science. Tattoo it on your arm. 🖋️
  • Linear Regression: Predicting a number based on other numbers
  • R: squared: How well does your model explain the data?
  • Residuals: The gap between prediction and reality
# Does ad spend predict revenue?
import numpy as np
from sklearn.linear_model import LinearRegression

ad_spend = np.array([1000, 2000, 3000, 4000, 5000]).reshape(: 1, 1)
revenue = np.array([10000, 18000, 28000, 35000, 48000])

model = LinearRegression()
model.fit(ad_spend, revenue)

print(f"For every $1 in ad spend, revenue increases by ${model.coef_[0]: .2f}")
print(f"R: squared:  {model.score(ad_spend, revenue): .3f}")
# For every $1 in ad spend, revenue increases by $9.20
# R: squared:  0.993

📚 Free Resources:

2. Linear Algebra: The Language of Machine Learning 📐

If statistics is the king, linear algebra is the queen. You can’t understand how ML algorithms work under the hood without it.

But here’s the good news: you need way less than a full university course.

2.1 Vectors & Matrices

What it is: Organizing numbers in rows, columns, and grids.

Topics you need:

  • Vectors: A list of numbers. That’s it. Your feature set for one data point IS a vector.
  • Matrices: A grid of numbers. Your entire dataset IS a matrix.
  • Matrix operations: Addition & subtraction, Scalar multiplication
  • Matrix multiplication (the big one: this is how neural networks work)
  • Transpose
  • Dot product: How similar are two vectors? This is the core of recommendation systems and similarity search.

Where you’ll use this in real life:

Your entire dataset is a matrix. Every row is a data point (vector). Every column is a feature. When you train a model, you’re doing matrix operations on this data.

import numpy as np

# Your dataset IS a matrix
data = np.array([
    [25, 50000, 3],    # Person 1:  age, salary, years_experience
    [30, 65000, 5],    # Person 2
    [35, 80000, 8],    # Person 3
    [28, 55000, 4],    # Person 4
])

print(f"Shape:  {data.shape}")  # (4, 3): 4 people, 3 features
# That's a 4x3 matrix. You've been doing linear algebra all along! 😄

# Dot product: similarity between two people's profiles
person_1 = data[0]
person_2 = data[1]
similarity = np.dot(person_1, person_2)
print(f"Dot product (similarity):  {similarity}")

📚 Free Resources:

2.2 Eigenvalues & Eigenvectors

Special directions in your data that capture the most information.

Don’t panic. This sounds scary but the intuition is simple.

Imagine you have a cloud of data points in 3D space. An eigenvector points in the direction where the data varies the most. The eigenvalue tells you HOW MUCH it varies in that direction.

Where you’ll use this in real life:

PCA (Principal Component Analysis): the most common dimensionality reduction technique. When you have 100 features and want to reduce to 10 while keeping most of the information: that’s PCA, and PCA is all eigenvectors.

from sklearn.decomposition import PCA
import numpy as np

# 100 features is too many. Let's reduce to the most important 10.
data = np.random.randn(1000, 100)  # 1000 samples, 100 features

pca = PCA(n_components=10)
reduced_data = pca.fit_transform(data)

print(f"Original shape:  {data.shape}")        # (1000, 100)
print(f"Reduced shape:  {reduced_data.shape}")  # (1000, 10)
print(f"Variance retained:  {sum(pca.explained_variance_ratio_): .1%}")
  • Under the hood, PCA found the eigenvectors of your data’s covariance matrix and kept the ones with the largest eigenvalues.
  • You don’t need to compute this by hand: but understanding WHY it works makes you a better data scientist.

📚 Free Resources:

2.3 Matrix Factorization

What it is: Decomposing a matrix into simpler pieces.

Where you’ll use this in real life:

Recommendation systems. Netflix’s famous algorithm? Matrix factorization. It decomposes the giant user: movie rating matrix into two smaller matrices: one capturing user preferences and one capturing movie characteristics.

Also used in: topic modeling (NMF), image compression (SVD), and collaborative filtering.

📚 Free Resources:

3. Calculus: The Optimization Engine ⚙️

Here’s where I save you TONS of time.

You need calculus for ONE primary reason in data science: understanding how models learn.

When a machine learning model “trains,” it’s using calculus to minimize errors. Specifically, it uses gradient descent: which is just fancy calculus applied repeatedly.

3.1 Derivatives

What it is: How fast something is changing at any given point. The slope.

Topics you need:

  • What a derivative means: Rate of change, slope of a curve
  • Basic derivative rules: Power rule, chain rule (yes, just these two get you surprisingly far)
  • Partial derivatives: Derivative with respect to ONE variable while holding others constant. This is key for multivariable models.
  • Gradient: A vector of partial derivatives. It points in the direction of steepest increase.

Where you’ll use this in real life:

Gradient descent: the core optimization algorithm behind almost every ML model.

Here’s the intuition: Imagine you’re blindfolded on a hilly landscape. You want to find the lowest point (minimum error). You can feel the slope under your feet (gradient). You take a step downhill. Feel the slope again. Step downhill again. Repeat until you reach the bottom.

That’s gradient descent. And the “feeling the slope” part? That’s a derivative. 🏔️

# Gradient descent: the core of ML training: in 10 lines
import numpy as np

# Simple function:  f(x) = x^2 (we want to find the minimum)
# Derivative:  f'(x) = 2x

x = 10.0               # Start at x = 10
learning_rate = 0.1     # How big each step is

for i in range(50): 
    gradient = 2 * x    # The derivative (slope at current point)
    x = x: learning_rate * gradient   # Step downhill
    if i % 10 == 0: 
        print(f"Step {i}:  x = {x: .6f}, f(x) = {x**2: .6f}")
# Step 0:   x = 8.000000, f(x) = 64.000000
# Step 10:  x = 1.073742, f(x) = 1.152921
# Step 20:  x = 0.014412, f(x) = 0.000208
# Step 30:  x = 0.000194, f(x) = 0.000000
# Step 40:  x = 0.000003, f(x) = 0.000000

It found the minimum (x = 0) all by itself, just by following the gradient downhill. Every neural network, every logistic regression, every gradient: boosted tree: they all do this. 🎯

📚 Free Resources:

3.2 Integrals

What it is: The area under a curve. The reverse of derivatives.

Where you’ll use this in real life:

  • Probability density functions (the area under the curve = probability)
  • AUC: ROC metric (Area Under the Curve: literally an integral)
  • Understanding cumulative distribution functions

📚 Free Resources:

3.3 What About Multivariable Calculus?

You’ll hear people say you need multivariable calculus. Here’s the honest truth:

What you actually need:

  • Partial derivatives (how to take derivative with respect to one variable)
  • The gradient (vector of partial derivatives)
  • Chain rule (how derivatives compose: this is how backpropagation works)

What you DON’T need:

  • Line integrals
  • Surface integrals
  • Green’s theorem
  • Stokes’ theorem
  • Divergence theorem

If you’re not going into deep learning research, the basics above are enough. Save yourself months of study. 🎉

4. Discrete Math: The Supporting Actor 🎭

Discrete math is the “nice to have” in data science. You won’t use it every day, but it pops up in specific areas.

4.1 Set Theory (Basics)

What it is: Operations on collections: union, intersection, difference.

Where you’ll use this: SQL joins are literally set operations. Venn diagrams in data analysis. Feature set operations.

: :  SQL joins ARE set theory
SELECT * FROM orders
INNER JOIN customers ON orders.customer_id = customers.id
: :  This is an intersection of two sets!

How deep: Know union, intersection, difference, and subsets. That’s it. You probably already know this intuitively.

4.2 Combinatorics (Basics)

What it is: Counting arrangements: permutations and combinations.

Where you’ll use this: Feature selection (how many ways to choose 5 features from 50?), understanding model complexity, probability calculations.

How deep: Know the difference between permutation (order matters) and combination (order doesn’t matter). Know the formulas. That’s enough.

4.3 Graph Theory (Basics)

What it is: Networks of nodes and edges.

Where you’ll use this: Social network analysis, recommendation systems, fraud detection, knowledge graphs, route optimization.

How deep: Know what nodes, edges, directed vs undirected graphs, and shortest paths are. Go deeper only if you work specifically with graph data.

📚 Free Resources:

💡 Key principle: Learn math just in time, not just in case. When you encounter a concept in a machine learning course and don’t understand it: THEN go learn the math behind it. Context makes math 10x easier to learn.

The Ultimate Free Resources List 📚

Here’s every resource mentioned above, plus some extras, organized by platform:

🎥 YouTube Channels (The Holy Trinity)

Other great channels:

🌐 Interactive Platforms (Free)

📖 Free Books & Textbooks

🎓 Free Full Courses

Conclusion 💭

  • Math is not the gatekeeper of data science. Bad teaching is.
  • Don’t let math anxiety stop you.
  • The resources are free.
  • The explanations are better than they’ve ever been.
  • And you have something that math students in university don’t: a clear reason to learn every single topic.

메타데이터
post_id
2faae2023622
slug
math-for-data-science-the-only-topics-you-actually-need-and-where-to-learn-them-for-free-2faae2023622
url
https://medium.com/@atnofordatascience/math-for-data-science-the-only-topics-you-actually-need-and-where-to-learn-them-for-free-2faae2023622
canonical_url
https://medium.com/@atnofordatascience/math-for-data-science-the-only-topics-you-actually-need-and-where-to-learn-them-for-free-2faae2023622
author_url
https://medium.com/@atnofordatascience
status
ok
fetched_at
2026-07-29 12:21:14