chapter seven

7 Solving Systems of Linear Equations

 

This chapter covers

  • Detecting collisions of objects in a 2D video game
  • Writing equations to represent lines and finding where lines intersect in the plane
  • Picturing and solving systems of linear equations in 3D or beyond
  • Re-writing vectors as linear combinations of other vectors

When you think of algebra, you probably think of questions that require “solving for x.”  For instance, you probably spent quite a bit of time in algebra class learning to solve equations like “3x2 + 2x + 4 = 0,” that is, figuring out what value or values of x make the equation true.

Linear algebra, being a branch of algebra, has the same kinds of computational questions come up.  The difference is that what you’re solving for can be a vector or matrix rather than a number.  If you were taking a traditional linear algebra course, you’d have to memorize a lot of algorithms to solve these kinds of problems.  But because you have Python at your disposal, you only need to know how to recognize the problem you’re facing and choose the right library to find the answer for you.

7.1   Designing an arcade game

7.1.1   Modeling the game

7.1.2   Rendering the game

7.1.3   Shooting the laser

7.1.4   Exercises

7.2   Finding intersection points of lines

7.2.1   Choosing the right formula for a line

7.2.2   Finding the standard form equation for a line

7.2.3   Linear equations in matrix notation

7.2.4   Solving linear equations with numpy

7.2.5   Deciding whether the laser hits an asteroid

7.2.6   Identifying unsolvable systems

7.2.7   Exercises

7.3   Generalizing linear equations to higher dimensions

7.3.1   Representing planes in 3D

7.3.2   Solving linear equations in 3D

7.3.3   Studying hyperplanes algebraically

7.3.4   Counting dimensions, equations, and solutions

7.3.5   Exercises

7.4   Changing basis by solving linear equations

7.4.1   Solving a 3D example