Exercises — Elastic Net regularization
Before we start, let us make sure every symbol below is earned.
The picture below is the whole story of that update in one graph — keep it in view.

Level 1 — Recognition
L1.1 In the Elastic Net loss name each of the three terms and say what the letters and each control.
Recall Solution L1.1
- First term = data-fit / mean-squared error (the ). It wants the predictions to match .
- = the L1 penalty; the sum of absolute weights. Its corners on the axes create sparsity (exact zeros).
- = the L2 penalty; the sum of squared weights. It shrinks and groups correlated features.
- = how much total regularization (the overall strength knob).
- = what flavour (the mix). Lasso, Ridge.
L1.2 What is ? And ?
Recall Solution L1.2
Compare to .
- : → inside the dead zone → .
- : → survives; pull toward zero by : → .
L1.3 For , does the update ever produce an exact zero weight? Why?
Recall Solution L1.3
With the threshold is , so (no dead zone at all). The update becomes — pure proportional shrink. It reaches only if is exactly . So generically no zeros — that is exactly Ridge behaviour.
Level 2 — Application
L2.1 , , . Compute .
Recall Solution L2.1
Threshold . Since , the numerator . Therefore . The feature is dropped — its residual correlation cannot beat the L1 threshold.
L2.2 , , . Compute .
Recall Solution L2.2
- Threshold . → survives.
- Numerator .
- Denominator .
- (about ). Note the sign of carries straight through.
L2.3 Two identical standardized features ; OLS puts total weight on the pair. With any , what weights does Elastic Net choose, and why exactly those numbers?
Recall Solution L2.3
Along the flat data direction the only tie-breaker is the L2 term subject to . Minimising a sum of squares with a fixed sum happens at equality: . So . This is the grouping effect; see Feature Correlation & Multicollinearity. Check the minimisation: has derivative .
Level 3 — Analysis
L3.1 Show algebraically that when the Elastic Net update reduces to the pure Lasso update, and when it reduces to pure Ridge. State each resulting formula.
Recall Solution L3.1
- : threshold ; denominator . So — exactly the Lasso soft-threshold, no divisor.
- : threshold ; . Denominator . So — pure Ridge proportional shrink. The single formula therefore contains both endpoints; slides continuously between them.
L3.2 A student increases while holding fixed. Explain two separate effects on a surviving weight, and predict what eventually happens to it.
Recall Solution L3.2
With : threshold grows, and divisor grows.
- Effect 1 (numerator): the dead zone widens, subtracting more from ; eventually and the weight snaps to .
- Effect 2 (denominator): even before that, dividing by the growing shrinks the surviving value. Prediction: the weight shrinks continuously and then hits exactly once (from ). This is the bias increasing / variance decreasing trade of Bias-Variance Tradeoff.
L3.3 At , , find the exact at which the weight first becomes zero, and evaluate just below that at .
Recall Solution L3.3
Zero happens when threshold : . At : numerator ; denominator ; . So just before dropping it is a small positive number, then it collapses to at — continuous, not a jump.
Level 4 — Synthesis
L4.1 Derive the update from scratch for one coordinate. Start from with standardized features () and . Show every case.
Recall Solution L4.1
Differentiate the smooth parts. The quadratic term: (using ). The L2 term derivative: . Handle the non-smooth via subgradient for , and at . Setting the subgradient to contain : Case : : . Valid only if RHS , i.e. . Case : : , valid if . Case : need , i.e. . Stitching all three cases: Uses Coordinate Descent (optimise one , hold the rest fixed).
L4.2 You have three features: perfectly correlated and each mildly useful, and pure noise. Predict qualitatively what Lasso vs Elastic Net do, and connect to the three parts of the update.
Recall Solution L4.2
- (noise): , so → soft-threshold kills it → . Both Lasso and Elastic Net drop it (L1 dead zone).
- (correlated, useful): Lasso's flat objective picks one arbitrarily and zeros the other → unstable across resamples. Elastic Net's denominator (L2) is strictly convex → splits the weight evenly → stable grouping. So: numerator/L1 removes junk; denominator/L2 stabilises the correlated group. That is precisely the "why not both" pitch.
Level 5 — Mastery
L5.1 Prove the grouping bound: for standardized identical features , the Elastic Net minimiser satisfies (exactly), for any , . Then compute the shared value when the effective residual correlation is , , — treating the pair as splitting a combined coordinate.
Recall Solution L5.1
Equality proof. Since , swapping leaves the data-fit and the L1 term unchanged, and leaves unchanged. So is symmetric in . is strictly convex in because the L2 term is strictly convex for (the data-fit and L1 are convex, adding a strictly convex term makes the whole strictly convex). A strictly convex function has a unique minimiser; a symmetric function's unique minimiser must lie on the symmetry axis . Hence . Shared value. Write . Their combined feature is ; treat the pair effectively so each carries residual correlation and each has its own L2 shrink. Solving the symmetric first-order condition gives each scaled by the split. Numerically: , divisor , single-coordinate value . Since the pair shares the load, each gets (half of ). , total .
L5.2 Show that Elastic Net's penalty is strictly convex for (hence unique solution), but only convex, not strictly for (hence Lasso's non-uniqueness). One sentence linking this to correlated-feature instability.
Recall Solution L5.2
Penalty .
- is convex but not strictly (it is linear along any orthant direction — flat pieces).
- is strictly convex (its Hessian is positive definite).
- For the coefficient , so inherits strict convexity → unique minimiser even when the data-fit is flat.
- For the strictly convex piece vanishes; is only convex, so along a data-flat direction the total objective is flat → infinitely many minimisers = Lasso instability on correlated features.

The 80/20 of this exercise set
Recall One-line recap
Recognition ::: L1 = dead-zone/threshold (numerator), L2 = divisor (denominator). Application ::: plug into , numerator first. Analysis ::: = amount, = flavour; weight drops to when . Synthesis ::: derive via subgradient; the kink at makes sparsity. Mastery ::: strict convexity () = unique solution = grouping/stability.
Connections
- Soft-Thresholding Operator — the numerator machine .
- Coordinate Descent — the one-weight-at-a-time algorithm behind every update above.
- Lasso Regression · Ridge Regression — the and endpoints.
- Feature Correlation & Multicollinearity — the disease the grouping proof cures.
- Bias-Variance Tradeoff · Cross-Validation — why and how you pick .