Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
15 Math Concepts Every Data Scientist Should Know

You're reading from   15 Math Concepts Every Data Scientist Should Know Understand and learn how to apply the math behind data science algorithms

Arrow left icon
Product type Paperback
Published in Aug 2024
Publisher Packt
ISBN-13 9781837634187
Length 510 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
David Hoyle David Hoyle
Author Profile Icon David Hoyle
David Hoyle
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Part 1: Essential Concepts FREE CHAPTER
2. Chapter 1: Recap of Mathematical Notation and Terminology 3. Chapter 2: Random Variables and Probability Distributions 4. Chapter 3: Matrices and Linear Algebra 5. Chapter 4: Loss Functions and Optimization 6. Chapter 5: Probabilistic Modeling 7. Part 2: Intermediate Concepts
8. Chapter 6: Time Series and Forecasting 9. Chapter 7: Hypothesis Testing 10. Chapter 8: Model Complexity 11. Chapter 9: Function Decomposition 12. Chapter 10: Network Analysis 13. Part 3: Selected Advanced Concepts
14. Chapter 11: Dynamical Systems 15. Chapter 12: Kernel Methods 16. Chapter 13: Information Theory 17. Chapter 14: Non-Parametric Bayesian Methods 18. Chapter 15: Random Matrices 19. Index 20. Other Books You May Enjoy

Matrices as transformations

Matrices are typically applied to vectors and other matrices through the process of matrix multiplication. However, the dry mechanics of matrix multiplication tend to hide what a matrix really represents and what matrix multiplication does. We aim to shed light on what matrices really are in this chapter. We’ll start by covering the basics of matrix multiplication and then show how matrices represent transformations.

Matrix multiplication

If we have a matrix <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:munder underaccent="false"><mml:mrow><mml:munder underaccent="false"><mml:mrow><mml:mi>A</mml:mi></mml:mrow><mml:mo>_</mml:mo></mml:munder></mml:mrow><mml:mo>_</mml:mo></mml:munder></mml:math> of size <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mrow><mi>M</mi><mo>×</mo><mi>K</mi></mrow></mrow></math>, and a matrix <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:munder underaccent="false"><mml:mrow><mml:munder underaccent="false"><mml:mrow><mml:mi>B</mml:mi></mml:mrow><mml:mo>_</mml:mo></mml:munder></mml:mrow><mml:mo>_</mml:mo></mml:munder></mml:math> of size <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mrow><mi>K</mi><mo>×</mo><mi>N</mi></mrow></mrow></math>, then we can multiply those two matrices together to get a new matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mrow><munder><munder><mi>C</mi><mo stretchy="true">_</mo></munder><mo stretchy="true">_</mo></munder><mo>=</mo><munder><munder><mi>A</mi><mo stretchy="true">_</mo></munder><mo stretchy="true">_</mo></munder><munder><munder><mi>B</mi><mo stretchy="true">_</mo></munder><mo stretchy="true">_</mo></munder></mrow></mrow></math>, which is of size <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mrow><mi>M</mi><mo>×</mo><mi>N</mi></mrow></mrow></math>. The matrix element <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:msub><mml:mrow><mml:mi>C</mml:mi></mml:mrow><mml:mrow><mml:mi>i</mml:mi><mml:mi>j</mml:mi></mml:mrow></mml:msub></mml:math> is calculated as follows:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow><mrow><msub><mi>C</mi><mrow><mi>i</mi><mi>j</mi></mrow></msub><mo>=</mo><mspace width="0.25em" /><mrow><munderover><mo>∑</mo><mrow><mi>k</mi><mo>=</mo><mn>1</mn></mrow><mi>K</mi></munderover><msub><mi>A</mi><mrow><mi>i</mi><mi>k</mi></mrow></msub></mrow><msub><mi>B</mi><mrow><mi>k</mi><mi>j</mi></mrow></msub></mrow></mrow></math>

Eq. 10

In this example, we are multiplying a <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mrow><mi>K</mi><mo>×</mo><mi>N</mi></mrow></mrow></math> matrix by an <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>M</mml:mi><mml:mo>×</mml:mo><mml:mi>K</mml:mi></mml:math> matrix. Schematically, we can write this as follows:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow><mrow><mtable columnwidth="auto" columnalign="center" rowspacing="1.0000ex" rowalign="baseline baseline"><mtr><mtd><mrow><mi>M</mi><mo>×</mo><mi>N</mi></mrow></mtd></mtr><mtr><mtd><mrow><mtext>Matrix</mtext><munder><munder><mi>C</mi><mo stretchy="true">_</mo></munder><mo stretchy="true">_</mo></munder></mrow></mtd></mtr></mtable><mo>=</mo><mtable columnwidth="auto" columnalign="center" rowspacing="1.0000ex" rowalign="baseline baseline"><mtr><mtd><mrow><mi>M</mi><mo>×</mo><mi>K</mi></mrow></mtd></mtr><mtr><mtd><mrow><mtext>Matrix</mtext><munder><munder><mi>A</mi><mo stretchy="true">_</mo></munder><mo stretchy="true">_</mo></munder></mrow></mtd></mtr></mtable><mo>×</mo><mtable columnwidth="auto" columnalign="center" rowspacing="1.0000ex" rowalign="baseline baseline"><mtr><mtd><mrow><mi>K</mi><mo>×</mo><mi>N</mi></mrow></mtd></mtr><mtr><mtd><mrow><mtext>Matrix</mtext><munder><munder><mi>B</mi><mo stretchy="true">_</mo></munder><mo stretchy="true">_</mo></munder></mrow></mtd></mtr></mtable></mrow></mrow></math>

Eq. 11

From this, it is clear that the “inner” dimensions in this example match, both being <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>K</mml:mi></mml:math>. To multiply two matrices together, the inner dimensions must match, when we write...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image