Functions, Limits, and Continuity
“A function” sounds like the least interesting item on a prerequisites list. It is on this one because Chapter 2 will ask whether a linear mapping is injective, surjective or bijective and use the answer to decide whether a matrix has an inverse — and Chapter 5 will differentiate things, which requires a limit, which requires knowing what a limit is.
Both are ten-minute ideas that get skipped and then quietly cost hours.
What you’ll learn
Section titled “What you’ll learn”- Domain, codomain and image, and why the image is usually smaller than the codomain.
- Injective, surjective, bijective — and the exact sentence that connects them to matrix inverses.
- What a limit is, including the two-sided requirement that makes it fail.
- Continuity as “no jumps”, stated precisely enough to check.
- Why differentiable implies continuous but not the reverse, with ReLU as the example that matters.
Intuition: a function is a machine with a rule
Section titled “Intuition: a function is a machine with a rule”A function is three things, not one: a set of allowed inputs, a set the outputs are drawn from, and a rule. The rule must give exactly one output for each input — that requirement is the whole definition, and everything else is bookkeeping about the two sets.
flowchart LR D["domain
every allowed input"] -->|"rule f"| C["codomain
the set outputs are drawn from"] D -.-> I["image
the outputs actually produced"] I --> C C --> N["codomain minus image
values f never reaches"]
The gap between image and codomain is the part people skip, and it is exactly the gap that Chapter 2 turns into a statement about solvability. If with domain and codomain both , the image is only . Ask for an with and there is none — not because the arithmetic is hard, but because is in the codomain and not in the image. Replace with a matrix and that is precisely the situation ” has no solution”.
The math
Section titled “The math”The three sets
Section titled “The three sets”- is the domain: every input the function accepts.
- is the codomain: the set the outputs live in.
- is the image: the outputs actually achieved.
The book writes for the image of a linear mapping and calls it the range or column space when is a matrix. Same object, three names, and §2.7 uses all of them.
Injective, surjective, bijective
Section titled “Injective, surjective, bijective”These three words are the reason this page exists.
In words a reader can hold on to:
| property | plain English | what fails without it |
|---|---|---|
| injective | different inputs give different outputs — nothing collapses | you cannot undo : two inputs share an output, so “which one was it?” has no answer |
| surjective | every value in the codomain is hit by something | some targets are unreachable, so “solve ” can fail |
| bijective | a perfect pairing, both ways | nothing; a bijection has a genuine inverse |
An inverse exists exactly when is bijective. That is the sentence. Chapter 2 then says: a square matrix is invertible exactly when the linear mapping it defines is bijective, which happens exactly when its columns are linearly independent, which happens exactly when its rank is full, which happens exactly when its determinant is nonzero. Five statements, one condition — and the chain starts here.
Limits
Section titled “Limits”reads: as gets arbitrarily close to , gets arbitrarily close to . Two things this does not say, both of which matter:
- It says nothing about . The function need not even be defined at .
- It requires the same from both sides.
The two-sided requirement is where limits fail:
For the left limit at is and the right limit is . They disagree, so does not exist — regardless of the fact that is perfectly well defined.
The canonical example of a limit that exists where the function does not is
which is undefined at but has a perfectly good limit approaching it. Every derivative is a limit of this kind: a quotient that is at the point of interest and has a limit anyway.
Continuity
Section titled “Continuity”is continuous at when all three of these hold:
- is defined,
- exists,
- they are equal: .
Continuous on an interval means continuous at every point of it. Informally: you can draw the graph without lifting the pen. All three conditions are needed — a function can satisfy any two and fail the third, which is why the definition is a list rather than a sentence.
Differentiability
Section titled “Differentiability”is differentiable at when that limit exists. Because it is a two-sided limit, the slope approaching from the left must match the slope approaching from the right.
but not the other way round. The implication holds because the difference quotient can only have a finite limit if the numerator goes to zero, which is continuity. The converse fails at any corner.
Worked example by hand
Section titled “Worked example by hand”Check the three continuity conditions and differentiability at for five functions.
| defined? | limit at exists? | equal? | continuous? | differentiable at ? | |
|---|---|---|---|---|---|
| yes, | yes, | yes | yes | yes, | |
| yes, | yes, | yes | yes | no: slopes and | |
| yes, | yes, | yes | yes | no: slopes and | |
| yes, | no: vs | — | no | no | |
| no | yes, | — | no at | no |
Read the last two rows carefully — they fail for opposite reasons. is defined at zero but has no limit there; has a limit but is not defined there. The second is removably discontinuous: define and it becomes continuous. The first cannot be fixed by any choice of , because there is no single value both sides approach.
Now the difference quotient for at , numerically:
The quotient does not settle on one number as ; it settles on two, depending on the sign of . That is what “the limit does not exist” looks like when you compute it.
See it move
Section titled “See it move”Drag the gap towards zero and watch the secant line become the tangent. Switch the function with the second knob: on the smooth ones the two secants converge; on the corner they converge to different lines, which is non-differentiability made visible.
Set the function to |x|, put at , then drag all the way down. On the smooth functions the
two slope readouts converge. On the corner they stay stubbornly at and no matter how small
gets — and that is the limit failing to exist, watched rather than asserted.
On real data
Section titled “On real data”Reading the plot
Section titled “Reading the plot”In the right-hand panel of the second figure, the gap between the two curves does not narrow. It is constant at all the way down to , and it would stay if you continued. That matters because it distinguishes a genuine non-differentiability from a numerical artefact: a real derivative shows the two branches converging as shrinks, until floating-point noise takes over somewhere around and they start to diverge again. Noise-driven divergence gets worse as shrinks; a corner’s gap is flat.
That distinction is how §5.5’s gradient-checking recipe knows the difference between a bug and a kink.
Pitfalls
Section titled “Pitfalls”Compare
Section titled “Compare”| property | means | matrix version (§2.7) | why you care |
|---|---|---|---|
| injective | no two inputs collide | ; columns independent | at most one solution to |
| surjective | every target is reached | ; full row rank | at least one solution, for every |
| bijective | both | square and invertible; | exactly one solution, always |
| continuous | no jumps | — | the function is well-behaved enough to optimise |
| differentiable | one tangent | — | gradient descent has something to follow |
-
A function has an inverse exactly when it is which of these?
Injective alone leaves some targets with no preimage; surjective alone leaves some targets with several. Only both together give a well-defined inverse — which is the condition Chapter 2 turns into matrix invertibility.
pch.quizShowAnswer
C — Bijective — Injective alone leaves some targets with no preimage; surjective alone leaves some targets with several. Only both together give a well-defined inverse — which is the condition Chapter 2 turns into matrix invertibility.
-
ReLU is continuous everywhere but not differentiable at zero. Why not?
There is no jump, so it is continuous. But the difference quotient tends to zero from one side and one from the other, and a derivative is a two-sided limit. Frameworks return zero there by convention.
pch.quizShowAnswer
C — The slope approaching from the left is zero and from the right is one, so the two-sided limit does not exist — There is no jump, so it is continuous. But the difference quotient tends to zero from one side and one from the other, and a derivative is a two-sided limit. Frameworks return zero there by convention.
-
Sine of x divided by x is undefined at zero, yet its limit there is one. What does that make the discontinuity?
Both sides approach the same value, so filling in that value repairs it. Contrast the sign function, where the two sides approach different values and no choice of value at zero can help.
pch.quizShowAnswer
A — Removable — defining the value at zero to be one makes it continuous — Both sides approach the same value, so filling in that value repairs it. Contrast the sign function, where the two sides approach different values and no choice of value at zero can help.
-
For a linear mapping, checking injectivity reduces to what?
Linearity turns the all-pairs condition into a single homogeneous system: the kernel is trivial. That collapse is what makes linear algebra computationally tractable.
pch.quizShowAnswer
B — Checking that only the zero vector maps to zero — Linearity turns the all-pairs condition into a single homogeneous system: the kernel is trivial. That collapse is what makes linear algebra computationally tractable.
🧪 Try It Yourself
Section titled “🧪 Try It Yourself”Exercise 1 – The image is smaller than the codomain
Section titled “Exercise 1 – The image is smaller than the codomain”Exercise 2 – Injectivity fails when outputs collide
Section titled “Exercise 2 – Injectivity fails when outputs collide”Exercise 3 – One-sided limits of the sign function
Section titled “Exercise 3 – One-sided limits of the sign function”Exercise 4 – The difference quotient of ReLU at zero
Section titled “Exercise 4 – The difference quotient of ReLU at zero”Exercise 5 – Convergence versus a constant gap
Section titled “Exercise 5 – Convergence versus a constant gap”Recall card
Section titled “Recall card”- A function is three things — domain, codomain, and a rule giving exactly one output per input.
- The image can be smaller than the codomain, and that gap is exactly what “no solution to Ax = b” means.
- Injective — different inputs never collide, so at most one solution exists.
- Surjective — every element of the codomain is reached, so at least one solution exists for every target.
- An inverse exists exactly when the function is bijective — the sentence Chapter 2 turns into matrix invertibility.
- For a linear map, injective means the kernel is trivial, which turns an all-pairs check into one homogeneous system.
- A limit requires both sides to agree and says nothing about the value at the point.
- Continuity needs all three conditions: defined, limit exists, and the two are equal.
- Differentiable implies continuous, never the reverse — ReLU is continuous everywhere and non-differentiable at zero, where frameworks return zero by convention.
- A corner’s one-sided gap stays constant as h shrinks, while floating-point noise grows — which is how gradient checking distinguishes a kink from a bug.
Next: the derivative rules themselves, derived rather than listed — Single-Variable Calculus Refresher.
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading