A collection of teaching scripts showing applications of linear algebra to chemistry, computer science, mechanical engineering, and more.
Updated 31 Jan 2024

Applied Linear Algebra

View Applied-Linear-Algebra on File Exchange or Open in MATLAB Online


This curriculum module contains interactive MATLAB® live scripts that apply fundamental concepts and basic terminology related to linear algebra. There is a focus on identifying applications of linear algebra to academic disciplines beyond mathematics.


You can use this live script as demonstrations in lectures, class activities, or interactive assignments outside class. Applied Linear Algebra covers topics from a first course in linear algebra including vector and matrix arithmetic, solving matrix equations, null spaces, eigenvalues, and eigenvectors. Applications include balancing chemical reactions, solving static force scenarios, encryption, systems modeling, and explainable machine learning.

The instructions inside the live scripts will guide you through the exercises and activities. Get started with each live script by running it one section at a time. To stop running the script or a section midway (for example, when an animation is in progress), use the EndIcon.png Stop button in the RUN section of the Live Editor tab in the MATLAB Toolstrip.

Contact Us

Solutions are available upon instructor request. Contact the MathWorks online teaching team if you would like to request solutions or have a question.


These scripts assume knowledge of basic linear algebra such as vectors, matrices, eigenvalues, and eigenvectors, as discussed in the related courseware on matrix methods. The focus of these scripts is on reinforcing the theoretical knowledge of linear algebra concepts by applying them in a variety of domains. There is minimal MATLAB knowledge required for these scripts, but you could use MATLAB Onramp as a resource to acquire familiarity with live scripts and MATLAB syntax.

Getting Started

Accessing the Module

On MATLAB Online:

Use the OpenInMO.png link to download the module. You will be prompted to log in or create a MathWorks account. The project will be loaded, and you will see an app with several navigation options to get you started.

On Desktop:

Download or clone this repository. Open MATLAB, navigate to the folder containing these scripts and double-click on [AppliedLinAlg.prj](matlab: openProject("AppliedLinAlg.prj")). It will add the appropriate files to your MATLAB path and open an app that asks you where you would like to start.

Ensure you have all the required products (listed below) installed. If you need to include a product, add it using the Add-On Explorer. To install an add-on, go to the Home tab and select AddOnsIcon.png Add-Ons > Get Add-Ons.

Working through the module:

  1. In the opening app, select "Main Menu" to open a brief hyperlinked navigation page or "README" to open this page. To give us feedback, select "Feedback".
  2. Get started with each topic by clicking the link to open the live script. The instructions inside each live script will walk you through the live script and related functions.


MATLAB® is used throughout. Tools from the Symbolic Math Toolbox™ are used frequently as well. The sevilla.jpg image in Steganography.mlx comes from the Image Processing Toolbox™. The IdentifyDigits and ReadMyWriting scripts use both the Image Processing Toolbox™, and the Statistics and Machine Learning Toolbox™. IdentifyDigits also uses the Deep Learning Toolbox™ while ReadMyWriting uses MATLAB Mobile.


Chemical reactions In this script, students will... Academic disciplines
Reaction.png • build and solve matrix equations
• identify the rank and null spaces of matrices
• balance chemical reactions
• Chemistry
• Mathematics
Zombie outbreak In this script, students will... Academic disciplines
SIZ-diagram-complete.png • compute powers of transition matrices
• compute eigenvalues and eigenvectors and explain their meaning in a modeling context
• create a model of a zombie outbreak
• analyze real-world scenarios for mayflies and HIV
• Biology
• Mathematics
Image encryption In this script, students will... Academic disciplines
SmStorm.png • use matrix arithmetic
• represent images and text as matrices
• encrypt images inside other images
• Computer Science
• Mathematics
Static force analysis In these scripts, students will... Academic disciplines
SupportedDoor.png • define and normalize vectors
• build and solve matrix equations
• calculate dot products and cross products
• solve for moments, tensions, and forces
• Civil Engineering
• Mechanical Engineering
• Mathematics
Machine learning In these scripts, students will... Academic disciplines
ConfusionMatrix.png • use singular value decomposition and distance
• use binary morphology tools to preprocess image data
• create a tool that will identify handwritten digits
• Computer Science
• Mathematics

Robotic manipulators In this script, students will... Academic disciplines
RoboticArm.png • compute the Cartesian result of a sum of polar vectors
• explore the concept of a configuration space through visualizations
• explain the connection between degrees of freedom, multiplicity of solutions, and the null space
• Mechanical engineering
• Mathematics


The license for this module is available in the

Related Courseware Modules

Or feel free to explore our other modular courseware content.

Educator Resources


Looking for more? Find an issue? Have a suggestion? Please contact the MathWorks teaching resources team. If you want to contribute directly to this project, you can find information about how to do so in the page on GitHub.

© Copyright 2023 The MathWorks, Inc.

Cite As

Emma Smith Zbarsky (2024). Applied-Linear-Algebra (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2023a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Mathematics and Optimization in Help Center and MATLAB Answers
More Files in the  Distance Learning Community

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

See release notes for this release on GitHub:

See release notes for this release on GitHub:


To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.