DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Efficient Transformer Attention for GenAI
  • Geo-Zoning Through Driving Distance Using K-Medoids Algorithm
  • Decoding the Confusion Matrix: A Comprehensive Guide to Classification Model Evaluation
  • How To Use GitLab for Simultaneous Execution of Jobs (Part 2)

Trending

  • Vibe Coding With GitHub Copilot: Optimizing API Performance in Fintech Microservices
  • Intro to RAG: Foundations of Retrieval Augmented Generation, Part 1
  • A Complete Guide to Modern AI Developer Tools
  • Is Agile Right for Every Project? When To Use It and When To Avoid It

Visualizing Matrix Multiplication as a Linear Combination

By 
Eli Bendersky user avatar
Eli Bendersky
·
Apr. 12, 15 · Interview
Likes (63)
Comment
Save
Tweet
Share
25.1K Views

Join the DZone community and get the full member experience.

Join For Free

when multiplying two matrices, there's a manual procedure we all know how to go through. each result cell is computed separately as the dot-product of a row in the first matrix with a column in the second matrix. while it's the easiest way to compute the result manually, it may obscure a very interesting property of the operation: multiplying a by b is the linear combination of a's columns using coefficients from b . another way to look at it is that it's a linear combination of the rows of b using coefficients from a .

in this quick post i want to show a colorful visualization that will make this easier to grasp.

right-multiplication: combination of columns

let's begin by looking at the right-multiplication of matrix x by a column vector:

representing the columns of x by colorful boxes will help visualize this:

matrix by vector

sticking the white box with a in it to a vector just means: multiply this vector by the scalar a. the result is another column vector - a linear combination of x's columns, with a, b, c as the coefficients.

right-multiplying x by a matrix is more of the same. each resulting column is a different linear combination of x's columns:

graphically:

matrix by matrix

if you look hard at the equation above and squint a bit, you can recognize this column-combination property by examining each column of the result matrix.

left-multiplication: combination of rows

now let's examine left-multiplication. left-multiplying a matrix x by a row vector is a linear combination of x's rows :

is represented graphically thus:

vector by matrix

and left-multiplying by a matrix is the same thing repeated for every result row: it becomes the linear combination of the rows of x, with the coefficients taken from the rows of the matrix on the left. here's the equation form:

and the graphical form:

matrix by matrix from the left
Matrix (protocol)

Published at DZone with permission of Eli Bendersky. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Efficient Transformer Attention for GenAI
  • Geo-Zoning Through Driving Distance Using K-Medoids Algorithm
  • Decoding the Confusion Matrix: A Comprehensive Guide to Classification Model Evaluation
  • How To Use GitLab for Simultaneous Execution of Jobs (Part 2)

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!