Vector Spaces & Subspaces
Which parts of a space are self-contained — so that adding or stretching arrows inside them never throws you out? Those are subspaces, decided by three quick checks. GATE's favourite trap dresses a set with squared coordinates so it looks linear but quietly fails closure.
What you'll learn
- What a vector space is, in plain terms
- The subspace test: contains 0, closed under addition, closed under scalar multiplication
- Lines and planes through the origin are subspaces; offset ones are not
- Why squared coordinates break closure — the real 2024 trap
Before you start
You already know how to add arrows and stretch them — that is the whole of working
inside a vector space. It is the polite name for any setting where addition and
scaling behave the way you expect (the plane R² and 3-D space R³ are the everyday
ones).
The interesting question, and the one GATE keeps asking, is which parts of that space are self-contained. Which collections of arrows are “complete”, in the sense that adding or stretching arrows from the collection never throws you outside it? Those complete parts are called subspaces, and they pass or fail on three quick checks.
The subspace test — three conditions
A subset W of a vector space is a subspace exactly when all three hold:
- It contains the zero vector — the origin
0is inW. - It is closed under addition — if
uandvare inW, so isu + v. - It is closed under scalar multiplication — if
vis inWandcis any scalar, so iscv.
Geometrically in R³, the only things that pass are:
- the origin alone
- every line through the origin
- every plane through the origin
- all of
R³
Anything that misses the origin, bends, or is bounded fails.
The fastest screen is condition 1. If the origin is not in the set, stop — it is not a subspace. That one check kills every “offset” set on sight.
Necessary is not sufficient
Do not let that speed run in the other direction, though. This is the classic slip: containing the origin is necessary, never sufficient. Passing check 1 tells you only that you must keep testing.
Take the first quadrant, {(x, y) : x ≥ 0 and y ≥ 0}. It holds the origin ✓ and even
survives check 2: adding two points with non-negative coordinates gives another ✓. Then
it dies at check 3, because scaling (1, 1) by −1 gives (−1, −1), which is nowhere
near the quadrant. All three conditions do independent work, and “every scalar” includes
the negative ones.
Drag the two arrows below and watch. As long as both live in your candidate subset, every sum and every scaled copy must too, or closure breaks. Line them up along a line through the origin and notice that addition and scaling never push you off it.
Drag the arrow tips — watch the dot product change
The trap GATE loves
Three flavours of set
The designed difficulty mixes three flavours of set:
- a genuine subspace (a linear equation through the origin)
- an affine set (a linear equation set equal to a non-zero constant, so it misses the origin)
- a set written with squared coordinates — which looks algebraic but breaks closure under scaling
GATE DA 2024 used squared coefficients precisely because they masquerade as linear.
Three sets, three outcomes
Decide which of these subsets of
R²are subspaces: (a){(x, y) : x + y = 0}, (b){(x, y) : x² + y² ≤ 1}, (c){(x, y) : x + y = 1}.
Set (a), x + y = 0 — a subspace. The origin gives 0 + 0 = 0 ✓. If two points
both satisfy it, so does their sum: (x₁+x₂) + (y₁+y₂) = 0. And scaling by c gives
cx + cy = c(x+y) = 0. All three pass — it is the line through the origin of slope
−1.
Set (b), the unit disk x² + y² ≤ 1 — NOT a subspace. The origin is inside, so
condition 1 passes, but closure fails: (1, 0) is in the disk, yet scaling by 2 gives
(2, 0) with 2² + 0² = 4 > 1, outside. The squared terms make the set bounded, and
scaling escapes it.
Set (c), x + y = 1 — NOT a subspace. Check the origin first: 0 + 0 = 0 ≠ 1, so
it fails immediately. This is the line x + y = 0 shifted off the origin.
Only (a) survives — three sets, three different reasons.
How big is a subspace?
Once a set passes the test, the natural follow-up is how big it is. A subspace’s
dimension counts the directions living inside it: 1 for a line, 2 for a plane, n
for the whole of Rⁿ.
You can usually read it straight off the defining equation, because each homogeneous linear equation you impose removes exactly one degree of freedom.
Set (a) is the smallest example of that. R² starts with two free coordinates. The
equation x + y = 0 forces y = −x, so choosing x decides everything — one free
coordinate remains, dimension 1, a line, exactly as we found.
Run the same count in R⁴ and one homogeneous equation leaves 4 − 1 = 3. In general,
k independent homogeneous equations in Rⁿ carve out a subspace of dimension n − k.
A question to carry forward
A line through the origin needs just one arrow to generate it; a plane needs two. Here is the thread onward — the word that followed us across from probability: those generating arrows must be independent, each pointing in a genuinely new direction the others cannot reach.
How few independent arrows does it take to build a whole subspace, and how do we tell when one is secretly redundant?
In one breath
- A subspace
Wpasses three tests: (1) contains 0, (2) closed under addition, (3) closed under scalar multiplication (every scalar, including −1). - Lead with the zero-vector check — if
0 ∉ W, stop (kills every offset/affine set likex+y=1). - In
R³, the only subspaces are:- the origin
- lines through 0
- planes through 0
- all of
R³
- A subspace equation is linear AND homogeneous (RHS = 0).
- The 2024 trap: squared terms (
x²+y² ≤ 1,x²=y) look algebraic but break closure under scaling — scale a member and it leaves the set. - One homogeneous equation in
Rⁿdrops the dimension by 1 (x+y+z=0inR³→ a 2-D plane).
Practice
Quick check
Practice this in an interview
All questionsEmbeddings are learned dense vectors that place semantically related data near one another in a model-specific geometric space. Vector search embeds a query, compares it with stored vectors using a metric such as cosine similarity, dot product, or Euclidean distance, and returns the nearest candidates.
The kernel trick lets an SVM find a nonlinear decision boundary by implicitly mapping data into a higher-dimensional space where it becomes linearly separable, without ever computing that mapping explicitly. It works because the SVM's dual formulation depends only on dot products between points, and a kernel function computes that dot product directly in the high-dimensional space. Common kernels are linear, polynomial, and RBF.
An SVM finds the hyperplane that maximises the margin between the two nearest points of each class (the support vectors). When data is not linearly separable, the kernel trick implicitly maps inputs to a high-dimensional feature space — computing inner products there without ever materialising the transformation — enabling non-linear decision boundaries at the cost of linear-space computation.
A vector database stores embeddings with metadata and searches their vector space using nearest-neighbor indexes. Because documents and queries are embedded by the same model, it can retrieve paraphrases and related concepts rather than only shared keywords; production systems often add metadata filters, lexical search, and reranking.