A vector is the most basic object in quantitative finance. When you hold a portfolio of three assets in proportions 50 percent, 30 percent, and 20 percent, you are really holding the vector w=(0.5,0.3,0.2). Almost everything that follows in this course is a manipulation of vectors and the matrices that act on them, so we start here.
Vectors in R-n
Formally, the space Rn is the set of all ordered lists of n real numbers. A typical element is written
References and further study
Know what to read—and why
Each source below is selected for this course. Use the study note to connect it to the lesson, then cite the original source in submitted work.
Copyright rule: MatheLinux links to the official source and stores only the citation. It does not copy or host external books, papers, videos, or datasets. Learners must quote sparingly, cite the source, and follow the source's own licence or terms.
Submit work
Before you continue
Lesson close · Linear Algebra & Optimization for Quants
Consolidate Vectors, Dot Products & Norms
Use this checkpoint to recall the lesson before marking it complete. The concepts below come from this lesson's authored sections.
Key concepts covered
01Vectors in R-n
02Addition and scaling
03The dot product
04The Euclidean norm
05The angle and cosine formula
What you should know now
□Explain Vectors, Dot Products & Norms in your own words and state the assumptions.
□Reproduce the main argument, derivation, or implementation without copying the lesson.
□
Stuck? Send a blocker
One sentence on what stopped you (definition, derivation, lab control, time). This feeds Module-1 product metrics — not a public comment thread.
Progress
Mark this lesson complete to track progress
Check one example against units, boundary conditions, or edge cases.
□Name one modeling or implementation limitation and when it matters.
Sequence
Continue to Matrices & Matrix Multiplication, the next prerequisite step in this course.
We think of x as an arrow from the origin to the point with those coordinates, or simply as a column of numbers. The number xi is the i-th component. In finance n might be the number of assets, the number of risk factors, or the number of dates in a return series.
Addition and scaling
Two vectors of the same length add component by component, and a scalar c∈R scales every component:
x+y=(x1+y1,…,xn+yn),cx=(cx1,…,cxn).
These two operations make Rn a vector space. Combining them gives a linear combinationax+by, the workhorse expression of the whole subject. A portfolio return is exactly such a combination: if assets have returns r1,r2,r3 and weights w1,w2,w3, the portfolio return is w1r1+w2r2.
The dot product
The dot product (or inner product) of two vectors in Rn is the single number
x⋅y=∑i=1nxiyi=x1y1+x2y2+⋯+xnyn.
It is symmetric, x⋅y=y⋅x, and linear in each argument. The portfolio return above is precisely the dot product w⋅r, which is why dot products are everywhere in finance: they collapse a weighted bet across many assets into one expected payoff.
The Euclidean norm
The Euclidean norm (length) of a vector is defined through its own dot product:
∥x∥=x⋅x=∑i=1nxi2.
For n=2 this is just the Pythagorean theorem. A unit vector has norm 1; we normalize any nonzero x by dividing by its norm, x^=x/∥x∥.
The angle and cosine formula
The dot product and the norm are tied together by the geometric identity
x⋅y=∥x∥∥y∥cosθ,
where θ is the angle between the two vectors. Solving for the angle gives the cosine formula
cosθ=∥x∥∥y∥x⋅y.
Derivation
Apply the law of cosines to the triangle whose two sides are x and y and whose third side is the difference x−y:
∥x−y∥2=∥x∥2+∥y∥2−2∥x∥∥y∥cosθ.
Now expand the left side algebraically using the definition of the norm:
∥x−y∥2=(x−y)⋅(x−y)=x⋅x−2x⋅y+y⋅y=∥x∥2−2x⋅y+∥y∥2.
Setting the two expressions equal, the ∥x∥2 and ∥y∥2 terms cancel, leaving −2x⋅y=−2∥x∥∥y∥cosθ. Dividing by −2 yields x⋅y=∥x∥∥y∥cosθ, exactly the identity above.
Orthogonality
When θ=90 degrees, cosθ=0, so x⋅y=0. Two vectors are orthogonal precisely when their dot product is zero. In finance, orthogonal return streams are uncorrelated bets that diversify each other, which is the mathematical heart of risk reduction.
Worked numeric example
Let x=(3,4) and y=(4,3). First the dot product:
x⋅y=(3)(4)+(4)(3)=12+12=24.
The norms:
∥x∥=32+42=25=5,∥y∥=42+32=25=5.
The cosine of the angle:
cosθ=(5)(5)24=2524=0.96.
So θ=arccos(0.96)≈16.26 degrees. The vectors point in nearly the same direction, consistent with a high cosine. As a sanity check, z=(4,−3) gives x⋅z=(3)(4)+(4)(−3)=12−12=0, so x and z are orthogonal.
Why quants care
A portfolio is a weight vector w, expected returns form a vector μ, and the expected portfolio return is the dot product w⋅μ. The cosine formula reappears as the correlation between two return series, and orthogonality is the formal statement that two strategies are uncorrelated. Norms measure the size of a position or the magnitude of a return, and they underlie the risk and tracking-error metrics you will meet later. Mastering these three operations, addition, the dot product, and the norm, gives you the language in which every later model is written.
Adapted from MIT OpenCourseWare (18.06 Linear Algebra / 6.255 Optimization), CC BY-NC-SA.
+
w3r3
Knowledge check
Q1.For vectors x and y in R-n, the dot product x dot y equals:
Q2.Two nonzero vectors are orthogonal exactly when:
Q3.The Euclidean norm of a vector x is defined as:
Q4.If a portfolio has weights w and assets have expected returns mu, the expected portfolio return is:
Problems
P1
Let x = (1, 2, 2) and y = (2, 0, 1). Compute cos(theta), the cosine of the angle between them. Give the answer as a decimal.
P2
For a portfolio with weight vector w = (w1, w2) and asset return vector r = (r1, r2), write the portfolio return as a dot product and state the general formula for n assets.
Submit work
Choose one lesson task
Optional human feedback—not required to mark the lesson complete. Pick a brief, submit it, or continue without submitting.
Optional
Human-graded work is a Pro course feature
The free lesson, quiz, and problem checks remain available. Pro members can choose a brief below, submit work, and receive a score and written feedback.