ML math for software engineers
Software engineers do not need to replay an entire mathematics degree before working with machine learning. They do need a connected set of ideas that explains model code, training behavior, and evaluation.
The right scope is determined by the work. Learn enough mathematics to predict what a tensor operation does, explain a loss, and diagnose a result that looks wrong.
Learn in dependency order
Start with linear algebra because most model code is organized around tensors and transformations. Then add calculus, probability, information theory, and optimization.
The subjects reinforce one another:
- Linear algebra describes representations and transformations.
- Calculus describes how a change in a parameter affects a loss.
- Probability describes uncertainty, data, and estimation.
- Information theory gives meaning to entropy and cross-entropy.
- Optimization describes how training searches for useful parameters.
This is a graph, not five separate courses. A softmax classifier, for example, touches every part of it.
Linear algebra for model code
Focus first on vectors, matrix multiplication, shapes, bases, projections, rank, and singular value decomposition. Learn to describe the operation geometrically and to trace its dimensions in code.
You should be able to answer questions such as:
- What information can this projection preserve?
- Why does a low-rank factorization reduce parameters?
- Which dimensions are mixed by this attention operation?
- Why is this matrix multiplication invalid?
MIT OpenCourseWare’s Linear Algebra course includes lectures, problems, and solutions. Use the problems; watching alone creates false confidence.
Calculus and automatic differentiation
The practical core is derivatives, partial derivatives, gradients, the chain rule, Jacobians, and Hessian intuition. Connect each concept to a computation graph.
Implement a small function by hand, derive its gradient, and compare the result with automatic differentiation. Then deliberately break the computation by detaching a value or using an unstable expression.
This turns “backpropagation” from a named algorithm into a sequence of local derivative calculations you can inspect.
Probability and information
Learn random variables, common distributions, conditional probability, Bayes’ rule, expectation, variance, likelihood, and sampling.
Then connect entropy, cross-entropy, and KL divergence to actual objectives. Ask which distribution is being compared, what expectation is estimated, and what the loss encourages the model to do.
The goal is not to recite definitions. It is to notice when an evaluation set, confidence score, or probabilistic assumption does not support the conclusion being made.
Optimization and numerical behavior
Study gradient descent, momentum, adaptive methods, learning-rate schedules, regularization, and basic conditioning. Pair the equations with loss curves and parameter updates.
Numerical behavior belongs in this section. Learn why stable softmax implementations subtract a maximum, how reduced precision changes calculations, and how exploding values appear in logs.
Software engineers already know that representations leak into reliability. Floating-point arithmetic is one more representation with operational consequences.
A practical study loop
Use a three-part loop for every topic:
- Explain the concept without notation.
- Work a small example by hand.
- Implement it and test an edge case.
Dive into Deep Learning combines mathematics and code. Fanout’s ML mathematics course is useful when you want a more explicit sequence through the foundations.
Do not move on because a video ended. Move on when you can solve a new problem, inspect the code, and explain the result.
What can wait
Measure theory, proof-heavy real analysis, and advanced optimization can wait for most applied engineering roles. They become important for particular research directions, not as a universal entry ticket.
Do not confuse “not first” with “never.” Let a real paper, bug, or research question pull you into deeper mathematics when the dependency appears.
Common questions
How do I know whether my math is strong enough?
Take a familiar model and explain its shapes, objective, gradients, assumptions, and failure modes. Any point where the explanation becomes memorized is a useful next topic.
Should I memorize derivations?
Memorize very little. Practice reconstructing key derivations from definitions. Reconstruction transfers when the interviewer or implementation changes the setup.
Can code replace working problems by hand?
No. Code provides scale and feedback, while hand calculations expose assumptions. A small amount of both is more useful than doing either one exclusively.