Part 0.5: Review

Vectors, what are they? Answer: Vectors are a pair of numbers that act as a set of instructions to stretch or squish coordinate system axes.

Linear Combinations, Span, and Basis Vectors? Answer: Linear Combinations are the processes of taking two or more vectors, scaling each by a specific number (a scalar), and then adding them together. The span is the set of all possible vectors that can be reached by taking every possible linear combination of a given pair (or set) of vectors. Basis vector is a set of linearly independent vectors that span the full space.

Linear Transformations? Answer: are ways to move or transform space while maintaining certain linear properties; going from input vector to a new output vector. Has two properties: straight lines and fixed origin. They keep gridlines parallel and evenly spaced.

Matrix Multiplication? Answer: combines rows from the first matrix with columns from the second matrix. For matrices A (m x n) and B (n x p), the result is a (m x p) matrix.

Drawing from the videos, one way to improve the teaching of matrices within the Yeshiva University’s Sy Syms School of Business curriculum is to create pairs of students who will code together according to their strengths and weaknesses and ‘debug’ each other.

Problem 1: Matrix Multiplication - Mechanics and Dimensions

(a) Compute AB

##      [,1] [,2]
## [1,]   16   -6
## [2,]   -4   11

(b) Dimension inference

## (3x4) x (4x2): defined -> result is 3x2
## (1x5) x (5x1): defined -> result is 1x1
## (4x3) x (2x3): NOT defined (inner dims 3 != 2)
## (2x2) x (2x3): defined -> result is 2x3

(c) Reverse engineering

Suppose AB = C, where C is a 3x4 matrix and A is 3x5. B must be 5x4. Since A is 3x5, B must have 5 rows to match A’s columns. Since C is 3x4, B must have 4 columns to produce a 3x4 result.

Problem 2: Function Composition - Why Order Matters

P is the projection onto the x-axis (keeps x-component, kills y-component). R is a 90 degree counterclockwise rotation.

(a) Compute PR and RP

## PR =
##      [,1] [,2]
## [1,]    0   -1
## [2,]    0    0
## RP =
##      [,1] [,2]
## [1,]    0    0
## [2,]    1    0

(b) Let v = (3, 2). Compute (PR)v and (RP)v.

## (PR)v =
##      [,1]
## [1,]   -2
## [2,]    0
## (RP)v =
##      [,1]
## [1,]    0
## [2,]    3

They are NOT the same - order of matrix multiplication matters.

(c) Test the two basis vectors.

## (PR)e1 =
##      [,1]
## [1,]    0
## [2,]    0
## (RP)e1 =
##      [,1]
## [1,]    0
## [2,]    1
## (PR)e2 =
##      [,1]
## [1,]   -1
## [2,]    0
## (RP)e2 =
##      [,1]
## [1,]    0
## [2,]    0

PR: e1 survives, e2 is destroyed. RP: e1 survives, e2 is destroyed but via a different path. The step applied FIRST determines what information is lost.

(d) Compute P squared.

##      [,1] [,2]
## [1,]    1    0
## [2,]    0    0

P^2 = P. This reveals that projections are idempotent: projecting twice is the same as projecting once.

(e) Interpretation

The analyst who projects first discards information before rotating. The analyst who rotates first preserves information longer before discarding it. General lesson: in multi-step models, order of operations changes the result.

Problem 3: Is This Transformation Linear?

(a) Portfolio return mapping

Portfolio A: 60% Stock, 30% Bond, 10% Cash. Portfolio B: 20% Stock, 50% Bond, 30% Cash. T is linear: output is a weighted sum of inputs with no constants or nonlinear terms.

##      [,1] [,2] [,3]
## [1,]  0.6  0.3  0.1
## [2,]  0.2  0.5  0.3
##      [,1]
## [1,]  0.6
## [2,]  0.2

T(e1) returns the first column of A. Each basis vector reveals one column of the matrix.

(b) Option payoff: T(x) = max(x - 50, 0), strike K = 50

## T(2x60) =
## [1] 70
## 2xT(60) =
## [1] 20
## T(30+40) =
## [1] 20
## T(30)+T(40) =
## [1] 0

Homogeneity fails and additivity fails - T is NOT linear and cannot be represented by a matrix. Punchline: option payoffs are non-linear so options require dedicated pricing models beyond simple matrix algebra.

Problem 4: Stress Testing with Matrices

(a) Set up the matrices

## [1] 500 300 200
##            Baseline Downturn
## Tech           0.01     0.08
## Energy         0.02     0.12
## RealEstate     0.03     0.15
## [1] 0.85 0.15

h is the exposure vector (3x1). L is the loss-rate matrix (3x2), rows = sectors, columns = scenarios. p is the scenario probability vector (2x1).

(b) Expected loss rate by sector: Lp

##              [,1]
## Tech       0.0205
## Energy     0.0350
## RealEstate 0.0480

(c) Total expected portfolio loss

##       [,1]
## [1,] 30.35

(d) Dollar losses by scenario

##      Baseline Downturn
## [1,]       17      106
##       [,1]
## [1,] 30.35

(h’L)p equals h’(Lp) - this illustrates associativity of matrix multiplication.

(e) New portfolio: Tech $600M, Energy $300M, RealEstate $100M

Only h changes - L and p stay the same.

##      [,1]
## [1,] 27.6

Advantage: swap one vector and instantly recompute - the matrix framework makes what-if analysis effortless.

(f) New forecast: P(Downturn) = 0.35

Only p changes - h and L stay the same.

##       [,1]
## [1,] 48.15