# Applications of Linear Algebra in Computing

Computer Science I · Algebra · https://tryals.app/learn/computer-science-i/applications-of-linear-algebra-in-computing

## Graphics and Data

Linear algebra powers computing: data and geometry are **vectors and matrices**, and computation is **matrix arithmetic**.

In **computer graphics**, 3D scenes are point vectors. **Linear transformations** (matrix multiplications) rotate, scale, and project them. The GPU is a machine for massive matrix-vector products.

In **machine learning**, datasets are matrices (rows are samples, columns are features).

| Tool | Definition | Computing Use |
| --- | --- | --- |
| **PCA** | Top **eigenvectors** of covariance matrix | Compresses data along informative directions |
| **Cosine similarity** | Normalized **dot product** | Measures similarity of feature vectors or word embeddings |
| **Neural network** | **Matrix multiply** plus nonlinearity | Weights times inputs; training adjusts matrices |

## Networks and the Big Picture

In **networks and ranking**, a graph's connections form an **adjacency matrix**. **PageRank** computes the dominant **eigenvector** of the web's link matrix to rank pages, a technique used across social and citation networks.

**Graphics pipeline formula:**
$v_{out} = M_2 (M_1 v)$
where $v$ is a vector, and $M_1, M_2$ are transformation matrices.

> **Common pitfall:** Treating these applications as unrelated tricks. Graphics, PCA, neural networks, and PageRank are all the same core operations: **matrix-vector products, dot products, and eigenvectors** applied to different data.

## Practice questions

6 of this lesson's 11 practice questions, with answers. The full set is in the app.

### 1. Select every computing area where linear algebra is central.

A. Alphabetically sorting strings
B. 3D computer graphics
C. Solving systems of equations
D. Search-engine ranking (PageRank)
E. Machine learning and data compression

**Answer:** B. 3D computer graphics; C. Solving systems of equations; D. Search-engine ranking (PageRank); E. Machine learning and data compression

**Why:** Graphics, ML, PageRank and equation-solving all represent data or geometry as vectors and matrices and compute with matrix arithmetic. Alphabetical string sorting is a comparison/ordering task with no linear-algebra content.

Page: https://tryals.app/practice/computer-science-i/applications-of-linear-algebra-in-computing/select-every-computing-area-where-linear-algebra-is-central

### 2. GPUs were designed to transform vertices for games and turned out to be what deep learning needed. What made the transfer possible?

A. Deep learning was designed around GPU capabilities from the start
B. GPUs are general-purpose processors that suit any parallel workload
C. Both fields were developed by the same companies, who reused the hardware deliberately
D. Both are dominated by matrix multiplication over large arrays

**Answer:** D. Both are dominated by matrix multiplication over large arrays

**Why:** Both are chains of matrix multiplies over large arrays with no dependencies between elements, which is precisely what thousands of simple parallel cores are for. The convergence was accidental and consequential. NVIDIA later added tensor cores specifically for it, and the deep learning boom followed the hardware.

Page: https://tryals.app/practice/computer-science-i/applications-of-linear-algebra-in-computing/gpus-were-designed-to-transform-vertices-for-games-and-turned-out-to

### 3. Machine learning, computer graphics and search engines all reduce to matrix arithmetic. Why does that convergence have practical consequences beyond being an elegant observation?

A. Because one optimised implementation serves all of them.
B. Because the three fields can share personnel, which lowers training costs.
C. Because matrix arithmetic is the only computation modern hardware supports.
D. Because the convergence proves the three fields are really one discipline.

**Answer:** A. Because one optimised implementation serves all of them.

**Why:** Effort spent optimising matrix multiplication benefits every field using it: GPUs were built to transform vertices, neural network training turned out to be chains of matrix multiplies, and the same hardware applied directly. It is why the standard advice is to express computation as matrix operations, not because it reads better, but because it routes work into optimised code.

Page: https://tryals.app/practice/computer-science-i/applications-of-linear-algebra-in-computing/machine-learning-computer-graphics-and-search-engines-all-reduce-to

### 4. A graphics engine applies a single 3x3 transformation matrix to each of 1000 vertices. If each matrix-vector product costs 9 multiplications, how many multiplications is that in total?

**Answer:** 9000

**Why:** 9 multiplications per vertex times 1000 vertices = 9000. Real scenes have millions of vertices, which is exactly why GPUs are built to do matrix-vector products in parallel at huge scale.

Page: https://tryals.app/practice/computer-science-i/applications-of-linear-algebra-in-computing/a-graphics-engine-applies-a-single-3x3-transformation-matrix-to-each

### 5. Order the stages a 3D graphics pipeline applies to a vertex, from model to screen.

**Answer:**

1. Start with the model's vertex position as a vector
2. Apply the model/world transformation matrix
3. Apply the camera (view) transformation
4. Apply the projection matrix to map onto the screen

**Why:** The pipeline chains transformation matrices: model/world, then view, then projection. Each is a matrix-vector product, which is exactly what GPUs are built to do at massive scale.

Page: https://tryals.app/practice/computer-science-i/applications-of-linear-algebra-in-computing/order-the-stages-a-3d-graphics-pipeline-applies-to-a-vertex-from

### 6. Sort each computing task by the linear-algebra tool it primarily uses.

**Answer:**

- Matrix multiplication: The graphics transformation pipeline
- Eigenvectors: PCA dimensionality reduction, PageRank's ranking vector
- Solving a linear system: Fitting a circuit's node voltages

**Why:** The graphics pipeline chains matrix multiplications. PCA and PageRank both extract a dominant eigenvector. Circuit node voltages come from solving a linear system of simultaneous equations.

Page: https://tryals.app/practice/computer-science-i/applications-of-linear-algebra-in-computing/sort-each-computing-task-by-the-linear-algebra-tool-it-primarily-uses
