PMAI Lab
Mathematics for AI · Artificial Intelligence
Reading time: 8–10 minutes
Research & Education

Why Mathematical Thinking Still Matters in the Age of Modern AI

Mathematics as the foundation of artificial intelligence — and what's actually happening underneath model.fit().

LINEAR ALGEBRA CALCULUS PROBABILITY OPTIMIZATION
§1

AI Is More Than Code

Abeginner entering artificial intelligence today can quickly learn to train a model. A few lines of Python can load a dataset, split it into training and testing sets, fit a model, and produce predictions.

model.fit(X_train, y_train) predictions = model.predict(X_test)

This is useful. But it does not explain what is actually happening.

These questions take us beyond programming and into mathematics. Programming gives us a way to implement an idea. Mathematics helps us understand the idea — a distinction that becomes increasingly important as we move from using AI models to developing, analyzing, and researching them.

§2

Linear Algebra: The Language of Data

Much of machine learning can be expressed naturally using vectors and matrices. Suppose we have a dataset containing information about students. Each student might be represented using features such as study hours, attendance, and previous score — already, this is a vector:

\[ x = \begin{bmatrix} \text{study hours} \\ \text{attendance} \\ \text{previous score} \end{bmatrix} \]

A dataset containing many observations can then be represented as a matrix:

\[ X = \begin{bmatrix} x_{11} & x_{12} & \cdots & x_{1p} \\ x_{21} & x_{22} & \cdots & x_{2p} \\ \vdots & \vdots & \ddots & \vdots \\ x_{n1} & x_{n2} & \cdots & x_{np} \end{bmatrix} \]
Figure 1. Each row of the matrix X is one observation; each column is one feature. Multiplying by the weight vector w collapses every row into a single prediction ŷ.

A linear regression model, for example, can be written as

\[ \hat{y} = Xw + b \]

The expression may look simple, but it captures an important computational process. The matrix X contains the information, the vector w contains parameters learned by the model, and b is the bias — the model combines all three to produce a prediction.

Once we begin looking at machine learning through this perspective, many apparently complicated operations become easier to understand. Even neural networks rely heavily on matrix operations. A layer can often be represented as

\[ z = Wx + b, \qquad a = f(z) \]

Repeated across multiple layers, these operations form the computational structure of a neural network. So when we talk about deep learning, we are also talking about linear algebra at scale.

§3

Calculus: How Does a Model Learn?

Knowing the structure of a model is not enough — we also need to understand how its parameters change. The model produces ŷ while the actual value is y. We need some measure of how far the prediction is from reality. One common choice is Mean Squared Error:

\[ \mathrm{MSE} = \frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2 \]

This gives us a quantity that represents the model's error. But now comes the important question: how do we reduce it? This is where calculus enters. We calculate the derivative of the loss function with respect to each parameter:

\[ \frac{\partial L}{\partial w} \]

The derivative tells us how the loss changes when w changes. A basic gradient-descent update can then be written as

\[ w_{\text{new}} = w_{\text{old}} - \eta \frac{\partial L}{\partial w} \]

where η is the learning rate

Figure 2. Gradient descent walks downhill along the loss surface L(w), one small step −η·∂L/∂w at a time, until it settles near a minimum w*.

This equation captures one of the central mechanisms behind machine learning: the model makes a prediction, we measure its error, we calculate a gradient, we update the parameters — then we repeat the process. What appears in software as a training loop has a mathematical structure underneath it.

§4

Probability: AI Rarely Deals With Certainty

Real-world data is rarely perfect. Measurements contain noise, people behave differently, sensors make errors, images may be incomplete, and a patient's symptoms may have several possible explanations. An autonomous system may not know exactly what will happen next.

This is why probability is so important in artificial intelligence. Instead of asking only “What is the answer?”, AI systems often need to consider “How likely is each possible answer?”. Probability gives us a mathematical language for uncertainty:

\[ P(Y \mid X) \]

the probability of an outcome Y given observed information X

Figure 3. Rather than a single answer, a probabilistic model returns a distribution over possible outcomes — a shape, not a point.

This idea appears throughout AI, including classification, Bayesian methods, probabilistic graphical models, generative models, and decision-making under uncertainty. For intelligent systems operating in real environments, uncertainty is not an inconvenience that can simply be ignored — it is part of the problem itself.

§5

Statistics: Learning From Data

Machine learning is fundamentally connected to statistics because we are trying to learn patterns from observations. Suppose we observe pairs (x₁, y₁), (x₂, y₂), …, (xₙ, yₙ) and want to learn something about the relationship between X and Y. But the observations we have are not necessarily the complete reality — they are a sample. This raises important questions.

These are not merely technical questions — they influence whether an AI system can be trusted. A model achieving excellent performance on its training data may still perform poorly when confronted with new observations. Understanding generalization therefore requires more than simply looking at an accuracy score.

A model that memorizes its training set has not learned a pattern — it has learned a list.ON OVERFITTING
§6

Optimization: Teaching a Model What to Do

Another major mathematical idea in AI is optimization. In many machine-learning problems, we want to find parameters that minimize an objective function. In abstract form:

\[ \theta^{*} = \operatorname*{arg\,min}_{\theta} \; L(\theta) \]

where L is a loss / objective function, and θ the parameters of the model

This expression appears in different forms throughout machine learning — linear regression, logistic regression, neural networks, regularized models. Many modern optimization problems can be viewed through this lens. The algorithms may become sophisticated, but the fundamental question remains the same: which parameters produce the best solution according to our chosen objective?

This is one reason optimization is particularly interesting at the intersection of mathematics and artificial intelligence — it connects theoretical mathematics with practical computation.

§7

From Equations to Algorithms

There is an important transition between understanding an equation and building an AI system. Consider the mathematical idea

\[ w_{t+1} = w_t - \eta \nabla L(w_t) \]

This is a mathematical rule. To turn it into a computational method, we need an algorithm — one that specifies how the data is represented, how the loss is calculated, how the gradient is obtained, how the parameters are updated, and when training should stop. Then we implement the algorithm using a programming language. This creates a chain:

For me, this connection is one of the most interesting aspects of AI — it allows an abstract mathematical concept to become an experiment that we can actually run.

§8

Where Python Fits In

Python has become one of the most useful tools for turning mathematical ideas into computational experiments.

But these tools should be viewed as instruments, not substitutes for understanding. A student who knows how to call a machine-learning function can train a model. A student who understands the mathematics can begin asking deeper questions about the model. And a researcher needs to go even further:

This is where computational thinking and mathematical thinking begin to complement one another.

§9

From Machine Learning to Intelligent Systems

The role of mathematics becomes even more interesting when we move beyond prediction. A traditional machine-learning model might answer “What is likely to happen?” An intelligent system may need to answer “What should I do?” — that introduces decision-making.

Suppose an autonomous agent is operating in an uncertain environment. It observes a state st, takes an action at, and receives some feedback rt. The system must decide which action is appropriate, often while balancing immediate and future consequences.

Figure 4. The agent–environment loop at the heart of reinforcement learning: a state leads to an action, which changes the environment and produces a reward, which shapes the next action.

This leads naturally toward reinforcement learning, optimization, control, planning, and decision theory. The mathematical perspective becomes particularly valuable here because intelligent behavior is not simply about recognizing patterns — it is also about reasoning under constraints and uncertainty.

§10

The PMAI Lab Perspective

The Python, Mathematics & Artificial Intelligence Lab is built around the belief that these areas should not be treated as isolated subjects. Python provides the computational environment. Mathematics provides the underlying language and reasoning framework. Artificial intelligence provides the broader problem-solving and research context.

Figure 5. Mathematics ⟷ Computation ⟷ Artificial Intelligence — PMAI Lab sits deliberately at the overlap of all three.

Our interest is not limited to teaching students how to use existing models. We are interested in understanding what happens underneath those models and how mathematical ideas can contribute to the development of better computational methods. This includes:

Machine LearningMathematical ModelingOptimization Computational MathematicsData ScienceDeep Learning Reinforcement LearningIntelligent SystemsScientific Computing AI-assisted Education

The common thread is mathematical and computational thinking.

§11

Learning AI From the Foundations Up

There are many possible ways to enter artificial intelligence. Some students begin with Python. Others begin with statistics. Some start with machine learning libraries. Others become interested through neural networks or generative AI. There is no single correct entry point. However, as one's understanding develops, the connections between these areas become increasingly important.

The purpose is not to memorize every equation, nor is it necessary to become a pure mathematician before studying AI. The real goal is to develop enough mathematical understanding to think about AI rather than merely operate AI tools.

§12

The Question We Should Keep Asking

Artificial intelligence is developing rapidly. New models appear constantly. New libraries and frameworks are released. Techniques that seem advanced today may become standard tomorrow. But the underlying mathematical ideas are much more stable.

WHAT DOESN'T CHANGE
Vectors will remain vectors. Optimization will remain optimization. Probability will remain a language for uncertainty. Derivatives will continue to describe rates of change.

This is why mathematical foundations remain valuable even as AI technology changes. Learning a particular software library may help us solve today's problem. Understanding the mathematics can help us approach tomorrow's problem.

Conclusion

Mathematics is not a prerequisite to get through — it's the language AI is written in.

Behind the algorithms are mathematical structures. Behind the optimization procedures are mathematical principles. Behind predictions are statistical assumptions. Behind learning are functions, gradients, probabilities, and optimization problems.

The objective is not simply to build models. It is to understand them, question them, improve them, and eventually develop new ideas. That is where mathematics, computation, and artificial intelligence meet.

\[ \text{Mathematical Thinking} + \text{Computational Thinking} = \text{Deeper AI Understanding} \]