Matrix Functions for Teaching and Learning Linear Algebra and Multivariate Statistics

Version 0.5.2

These functions are mainly for tutorial purposes in learning matrix algebra ideas using R. In some cases, functions are provided for concepts available elsewhere in R, but where the function call or name is not obvious. In other cases, functions are provided to show or demonstrate an algorithm.


Get the released version from CRAN:


The development version can be installed to your R library directly from this repo via:

 if (!require(devtools)) install.packages("devtools")

This installs the package from the source, so you will need to have R Tools installed on your system. R Tools for Windows takes you to the download page for Windows. R Tools for Mac OS X has the required programs for Mac OS X.

Alternatively, a Windows binary (not always current) is available at and can be installed via

install.packages("", repos=NULL)

This will usually be more current than the CRAN version, but less current than the GitHub version.


  1. Convenience functions:
  1. Determinants: functions for calculating determinants by cofactor expansion
  1. Elementary row operations: functions for solving linear equations "manually" by the steps used in row echelon form and Gaussian elimination
  1. Linear equations: functions to illustrate linear equations of the form A x = b
  1. Gaussian elimination: functions for illustrating Gaussian elimination for solving systems of linear equations of the form A x = b. These functions provide a verbose=TRUE argument to show the intermediate steps.
  1. Eigenvalues -- functions to illustrate the algorithms for calculating eigenvalues and eigenvectors


A small collection of vignettes is now available. Use browseVignettes("matlib") to see them.