Applied Metaphors: Learning TRIZ, Complexity, Data/Stats/ML using Metaphors
  1. Teaching
  2. Math Models for Creative Coders
  3. Maths Basics
  4. Matrix Algebra Whirlwind Tour
  • Teaching
    • Data Analytics for Managers and Creators
      • Tools
        • Introduction to R and RStudio
        • Introduction to Radiant
        • Introduction to Orange
      • Descriptive Analytics
        • Data
        • Summaries
        • Counts
        • Quantities
        • Groups
        • Densities
        • Groups and Densities
        • Change
        • Proportions
        • Parts of a Whole
        • Evolution and Flow
        • Ratings and Rankings
        • Surveys
        • Time
        • Space
        • Networks
        • Experiments
        • Miscellaneous Graphing Tools, and References
      • Statistical Inference
        • 🧭 Basics of Statistical Inference
        • 🎲 Samples, Populations, Statistics and Inference
        • Basics of Randomization Tests
        • 🃏 Inference for a Single Mean
        • 🃏 Inference for Two Independent Means
        • 🃏 Inference for Comparing Two Paired Means
        • Comparing Multiple Means with ANOVA
        • Inference for Correlation
        • 🃏 Testing a Single Proportion
        • 🃏 Inference Test for Two Proportions
      • Inferential Modelling
        • Modelling with Linear Regression
        • Modelling with Logistic Regression
        • 🕔 Modelling and Predicting Time Series
      • Predictive Modelling
        • 🐉 Intro to Orange
        • ML - Regression
        • ML - Classification
        • ML - Clustering
      • Prescriptive Modelling
        • 📐 Intro to Linear Programming
        • 💭 The Simplex Method - Intuitively
        • 📅 The Simplex Method - In Excel
      • Workflow
        • Facing the Abyss
        • I Publish, therefore I Am
      • Case Studies
        • Demo:Product Packaging and Elderly People
        • Ikea Furniture
        • Movie Profits
        • Gender at the Work Place
        • Heptathlon
        • School Scores
        • Children's Games
        • Valentine’s Day Spending
        • Women Live Longer?
        • Hearing Loss in Children
        • California Transit Payments
        • Seaweed Nutrients
        • Coffee Flavours
        • Legionnaire’s Disease in the USA
        • Antarctic Sea ice
        • William Farr's Observations on Cholera in London
    • R for Artists and Managers
      • 🕶 Lab-1: Science, Human Experience, Experiments, and Data
      • Lab-2: Down the R-abbit Hole…
      • Lab-3: Drink Me!
      • Lab-4: I say what I mean and I mean what I say
      • Lab-5: Twas brillig, and the slithy toves…
      • Lab-6: These Roses have been Painted !!
      • Lab-7: The Lobster Quadrille
      • Lab-8: Did you ever see such a thing as a drawing of a muchness?
      • Lab-9: If you please sir…which way to the Secret Garden?
      • Lab-10: An Invitation from the Queen…to play Croquet
      • Lab-11: The Queen of Hearts, She Made some Tarts
      • Lab-12: Time is a Him!!
      • Iteration: Learning to purrr
      • Lab-13: Old Tortoise Taught Us
      • Lab-14: You’re are Nothing but a Pack of Cards!!
    • ML for Artists and Managers
      • 🐉 Intro to Orange
      • ML - Regression
      • ML - Classification
      • ML - Clustering
      • 🕔 Modelling Time Series
    • TRIZ for Problem Solvers
      • I am Water
      • I am What I yam
      • Birds of Different Feathers
      • I Connect therefore I am
      • I Think, Therefore I am
      • The Art of Parallel Thinking
      • A Year of Metaphoric Thinking
      • TRIZ - Problems and Contradictions
      • TRIZ - The Unreasonable Effectiveness of Available Resources
      • TRIZ - The Ideal Final Result
      • TRIZ - A Contradictory Language
      • TRIZ - The Contradiction Matrix Workflow
      • TRIZ - The Laws of Evolution
      • TRIZ - Substance Field Analysis, and ARIZ
    • Math Models for Creative Coders
      • Maths Basics
        • Vectors
        • Matrix Algebra Whirlwind Tour
        • content/courses/MathModelsDesign/Modules/05-Maths/70-MultiDimensionGeometry/index.qmd
      • Tech
        • Tools and Installation
        • Adding Libraries to p5.js
        • Using Constructor Objects in p5.js
      • Geometry
        • Circles
        • Complex Numbers
        • Fractals
        • Affine Transformation Fractals
        • L-Systems
        • Kolams and Lusona
      • Media
        • Fourier Series
        • Additive Sound Synthesis
        • Making Noise Predictably
        • The Karplus-Strong Guitar Algorithm
      • AI
        • Working with Neural Nets
        • The Perceptron
        • The Multilayer Perceptron
        • MLPs and Backpropagation
        • Gradient Descent
      • Projects
        • Projects
    • Data Science with No Code
      • Data
      • Orange
      • Summaries
      • Counts
      • Quantity
      • 🕶 Happy Data are all Alike
      • Groups
      • Change
      • Rhythm
      • Proportions
      • Flow
      • Structure
      • Ranking
      • Space
      • Time
      • Networks
      • Surveys
      • Experiments
    • Tech for Creative Education
      • 🧭 Using Idyll
      • 🧭 Using Apparatus
      • 🧭 Using g9.js
    • Literary Jukebox: In Short, the World
      • Italy - Dino Buzzati
      • France - Guy de Maupassant
      • Japan - Hisaye Yamamoto
      • Peru - Ventura Garcia Calderon
      • Russia - Maxim Gorky
      • Egypt - Alifa Rifaat
      • Brazil - Clarice Lispector
      • England - V S Pritchett
      • Russia - Ivan Bunin
      • Czechia - Milan Kundera
      • Sweden - Lars Gustaffsson
      • Canada - John Cheever
      • Ireland - William Trevor
      • USA - Raymond Carver
      • Italy - Primo Levi
      • India - Ruth Prawer Jhabvala
      • USA - Carson McCullers
      • Zimbabwe - Petina Gappah
      • India - Bharati Mukherjee
      • USA - Lucia Berlin
      • USA - Grace Paley
      • England - Angela Carter
      • USA - Kurt Vonnegut
      • Spain-Merce Rodoreda
      • Israel - Ruth Calderon
      • Israel - Etgar Keret
  • Posts
  • Blogs and Talks

On this page

  • Introduction
  • What is a Matrix?
  • Transpose
  • Addition and Subtraction
    • Addition
    • Subtraction
  • Multiplication
  1. Teaching
  2. Math Models for Creative Coders
  3. Maths Basics
  4. Matrix Algebra Whirlwind Tour

Matrix Algebra Whirlwind Tour

Introduction

In this hopefully short and crisp tour, we will look at elementary operations on matrices: transpose, addition/subtraction and multiplication, and finally the inverse.

What is a Matrix?

An rectangular array of numbers, arranged with rows and columns. A few examples are:

Equation 1 is a 3 x 3 matrix (3 rows and 3 columns).

(1)[2,3,33,1,21,2,4]

Equation 2 is a 3 x 4 matrix (3 rows and 4 columns).

(2)[2,3,3,43,1,2,31,2,4,1]

Equation 3 is a 1 x 4 matrix (1 rows and 4 columns).

(3)[2 3 4 2]

Equation 2 is a 3 x 1 matrix (3 rows and 1 columns).

(4)[231]

Transpose

A matrix transpose is accomplished by writing rows as columns and vice versa. Hence an r x c matrix becomes transposed into a c x r matrix, as shown below:

c: ⎡a  c  1⎤
   ⎢       ⎥
   ⎣b  d  2⎦
c: ⎡a  b⎤
   ⎢    ⎥
   ⎢c  d⎥
   ⎢    ⎥
   ⎣1  2⎦

Addition and Subtraction

Matrices can be added or subtracted when they are of the same dimensions, rows and columns. Matrix elements are added or subtracted in element-wise fashion.

Addition

c: ⎡a  0⎤
   ⎢    ⎥
   ⎣b  1⎦
c: ⎡a  c⎤
   ⎢    ⎥
   ⎣b  1⎦
c: ⎡2⋅a  c⎤
   ⎢      ⎥
   ⎣2⋅b  2⎦

Subtraction

c: ⎡a  0⎤
   ⎢    ⎥
   ⎣b  1⎦
c: ⎡a  c⎤
   ⎢    ⎥
   ⎣b  1⎦
c: ⎡0  -c⎤
   ⎢     ⎥
   ⎣0  0 ⎦

Multiplication

Matrix multiplication can be visualized in many ways!! According to Gilbert Strang’s famous book on Linear Algebra, there are no less than 4 very useful ways. Let us understand perhaps the easiest one, Linear combination of Columns.

Suppose there are three students who bought two kinds of food and drink:

  • Student A: 2 samosas and 1 chai
  • Student B: 3 samosas and 0 chai
  • Student C: 0 samosa and 2 chai-s (Just before Arvind’s R class.)

Samosas cost 20 and chai costs 10. How much do they pay?

[213002]

[2010]

[506020]

A

B

C

We see that the first number 20 in B multiplies the entire first column in A, and the second number 10 multiplies the entire second column in A. These two multiplied columns are added to get the matrix C.

Suppose they had two options for shops? And the prices were different?

  • Samosas cost 20 and chai costs 10 at Shop#1. (as before)
  • Samosas cost 15 and chai costs 15 at Shop#2.

[213002]

[20151015]

[504560452030]

A2

B2

C2

Shop#2 is cheaper. Drag peasant#3 and go there, peasants#1 and #2.

How did this multiplication happen? Same story as with one shop/prices, repeated to handle the second shop. Matrix B2 now has two columns for prices, for Shop#1 and Shop#2. Multiplication takes each column in B2 and does the same weighted-column-addition with A2. Hence two columns of answers in C2.

ImportantMatrix Multiplication in 4 ways

As shown in Gilbert Strang’s book, there are 4 ways of thinking about matrix multiplication:

  • Our method of weighting columns in A using columns B and adding
  • Weighting rows in B using rows in A and adding
  • Multiplying individual values from rows in A and columns in B and adding up, for each location in C. ( This is the common textbook method)
  • Multiplying rows in A and columns in B. ( A vectorized version of the previous method).

For now, this one method should suffice.

References

  1. Gilbert Strang. Linear Algebra and its Applications. Thomson/Brooks-Cole.
  2. Glenn Henshaw.(Sep 28, 2019) Three Ways to Understand Matrix Multiplication. https://ghenshaw-work.medium.com/3-ways-to-understand-matrix-multiplication-fe8a007d7b26
Back to top
Vectors
Things at Right Angles

License: CC BY-SA 2.0

Website made with ❤️ and Quarto, by Arvind V.

Hosted by Netlify .