Exercises — Feature scaling - normalization vs standardization
This page tests everything from the parent note. Work each problem on paper before opening the solution. Difficulty climbs from "can you recall the formula?" to "can you design a scaling pipeline from scratch?".
Two formulas power everything below. Keep them in view:
A reminder of what every symbol means, since we use them constantly:
- ::: one raw data value we want to rescale.
- ::: the smallest and largest values in the training set.
- (mu) ::: the mean — the balance point of the data.
- (sigma) ::: the standard deviation — the typical distance of a point from .
The figure below stacks three rulers for the same five numbers . Read it top to bottom:
- Top (ink) ruler is the raw data — the point sits far to the right, stretching the line.
- Middle (teal) ruler is Min–Max: the left end now reads exactly (the old ) and the right end reads (the old ); every other point is a fraction of the way across.
- Bottom (plum) ruler is Z-score: the balance point has been slid to , and points to its left carry negative labels while points to its right carry positive ones. Notice the two rulers place the same points at different spots — that is the whole lesson of this page.

Level 1 — Recognition
Exercise 1.1
State which transformation guarantees an output strictly inside , and which one can produce values below or above . Give the one-line reason for each.
Recall Solution 1.1
Normalization guarantees : the minimum maps to and the maximum to ; everything between is a fraction of the range. Standardization is unbounded: a value far from (an outlier) has a large , so can be any real number. A point 4 standard deviations out simply becomes .
Exercise 1.2
For the dataset , without computing anything heavy, state the normalized value of and the standardized value of .
Recall Solution 1.2
Here , , and sits exactly in the middle, so normalized . The mean is , and is the mean, so its z-score is . Middle value → under Min–Max, under Z-score. This is the fastest sanity check you can run.
Level 2 — Application
Exercise 2.1
Normalize the dataset to .
Recall Solution 2.1
, , range .
Result: .
Exercise 2.2
Rescale the test scores to the range using the arbitrary-range formula
Recall Solution 2.2
Where the formula comes from (build it, don't memorize it). A rescaling to a target box is just a two-point linear map: a straight line that must pass through two known dots. Call the raw value and its scaled value . We demand:
- when , the output hits the bottom of the box: ;
- when , the output hits the top of the box: .
Step A — get a progress dial first. The fraction answers "how far along the raw range are we?" — it is at and at . This is our familiar plain normalization. Step B — stretch the dial to width and lift it to start at . Multiplying by makes it run from to ; adding slides that whole span up so it runs from to . Hence Check the two anchor dots: at , ; at , . ✓ The formula is nothing more than "compute progress, then rescale-and-shift the progress."
Now the numbers. Here , , , , range .
Result: . The middle score sits halfway because is the midpoint of .
Exercise 2.3
Standardize . Report , (population), and each z-score.
Recall Solution 2.3
Mean: . Variance: . Std dev: . Z-scores:
Notice the symmetry: the data is symmetric about , so the z-scores mirror around .
Level 3 — Analysis
Exercise 3.1
Dataset . Normalize it, then explain quantitatively why the first four points become nearly indistinguishable.
Recall Solution 3.1
, , range .
The first four values occupy the interval — barely of the whole box. Why: the range is set almost entirely by the outlier . Dividing by a huge range shrinks every ordinary gap (which is only ) down to . The outlier "eats" the scale.
The figure makes the failure visible. Compare the two rulers point-by-point:
- On the top (teal) Min–Max ruler, the four small numbers are pinned against the far left — the orange arrow points at a cluster so tight it looks like one dot in , while sits alone at the right edge.
- On the bottom (plum) Z-score ruler, those same four numbers spread out with visible gaps, and the orange arrow marks the outlier landing at a labelled rather than commandeering the whole scale. That widening of the left-hand cluster is exactly the "distinguishability" we quantify in Exercise 3.2.

Exercise 3.2
Same dataset . Standardize it and compare how well the first four points stay separated.
Recall Solution 3.2
Mean: . Variance: . Std dev: . Z-scores:
The first four span — a width of , versus normalization's . More importantly the outlier lands at instead of hogging the top of the scale, and it is clearly labelled as extreme rather than compressing the others. This is the concrete reason outlier-heavy data prefers standardization.
Level 4 — Synthesis
Exercise 4.1
You have a training set with , . You fit a Min–Max scaler on it. Later a test point arrives with value . Compute its normalized value and explain what "breaks".
Recall Solution 4.1
Using the training min and max (never refit on test data): The output is , outside the promised box. Nothing crashes — but any downstream component that assumes bounded inputs (e.g. a sigmoid expecting , or an image pipeline) is now fed an out-of-range value. This is normalization's fragility to unseen extremes, and exactly why standardization (which would just give a large z-score, no bound to break) is safer for unbounded features.
Exercise 4.2
A feature is measured in dollars, ranging roughly , is right-skewed with occasional huge values, and feeds a L2-regularized linear model. Choose a scaler, justify with three distinct reasons, and state one risk of the alternative.
Recall Solution 4.2
Choose standardization. Reasons:
- Outliers present — occasional huge dollar values would blow up the range and compress the bulk under Min–Max (Exercise 3.1's failure), whereas z-scores keep the bulk separated (Exercise 3.2).
- Unbounded / unknown future max — dollars have no natural ceiling, so a fixed box will be broken by future data (Exercise 4.1).
- Regularization fairness — L2 penalizes coefficients by size. Standardization gives every feature spread , so the penalty treats them comparably; leaving raw dollar magnitudes would let the range, not the signal, decide which coefficients get shrunk.
Risk of the alternative (normalization): a single extreme value sets , squashing all normal transactions into a razor-thin sliver near , destroying the model's ability to distinguish them.
Level 5 — Mastery
Before Exercise 5.1 we need two pieces of shorthand from statistics — both are just names for things you already computed above:
Exercise 5.1
Prove that standardization is invariant to the original units: if you rescale the raw data by any positive constant and shift it by any constant (i.e. ), the z-scores are unchanged.
Recall Solution 5.1
Let the new data be with . Use the two facts from the definition box above. New mean: . New std: (since ). New z-score: The cancels (both and carried it) and the cancels (numerator and denominator both scaled by it). Conclusion: converting dollars→cents or Celsius→Kelvin (a linear reshuffle) leaves standardized values identical. That "dimensionless" property is what makes z-scores comparable across features of different units.
Exercise 5.2
Show that Min–Max normalization is a special linear case by proving that for any dataset, the two extreme points always map to and , and that the map preserves the ordering and relative spacing of all points. Then give the single condition under which the formula is undefined and what it means.
Recall Solution 5.2
Write (the range). The map is , a linear function with positive slope (when ). Extremes: and . ✓ Order preserved: slope , so . ✓ Relative spacing preserved: for any three points the ratio of gaps is identical to the raw ratio — dividing by the same cancels. ✓ Undefined condition: if , the denominator is . This happens exactly when every value is identical (a constant feature). Interpretation: a constant feature carries no information to scale — the correct fix is to drop it (or map it to a constant like ), not to divide by zero.
Recall Quick self-grade checklist
- L1–L2 correct ::: you know the mechanics of both formulas.
- L3 correct ::: you understand why outliers favour standardization.
- L4 correct ::: you can pick a scaler from data properties, not slogans.
- L5 correct ::: you can prove the invariance and degeneracy properties from scratch.
Related deep dives: 3.2.03-Gradient-descent-optimization, 4.1.02-Distance-metrics-euclidean-manhattan-cosine, 6.2.01-Principal-Component-Analysis-PCA, 7.1.03-Batch-normalization-in-neural-networks, 2.1.01-Feature-types-and-data-structures.