Given a differentiable objective function:
The target is to locate an optimal vector within a designated feasible set :
The boundaries of the feasible set are algebraically constructed via finite sets of equality and inequality constraints:
- and represent discrete, finite index sets.
- The constraint mappings are assumed to be sufficiently smooth and continuously differentiable.
An optimization problem is classified as unconstrained if the feasible set encompasses the entire unrestricted vector space:
Under unconstrained conditions, solutions are analyzed using localized neighborhood behaviors rather than boundary intersections.
Unconstrained Local Optima (LOCAL MINIMA)
- A point represents a strict local minimum of a function if it yields the lowest scalar evaluation within an isolated domain.
- An element is a local minimum of if and only if there exists a localized open neighborhood, parameterized as an -ball (): Such that the following optimality condition holds strictly for all surrounding coordinates:
To mathematically verify that an unconstrained point is a local minimum, look at how the function behaves if you take a tiny step in any direction away from that point (). This neighborhood analysis relies on two conditions :
- The First Derivative Condition (Gradient): The slope at that exact coordinate must flatten out completely:
- The gradient vector ( or ) collects all the first partial derivatives, telling the steepness and direction of the slope.
- x is a critical point and it may correspond to a local maximum, a local minimum, or a saddle/inflection point.
When optimizing in multiple dimensions (like a neural network with many weights), looking at a single slope value is not enough to understand the surrounding terrain.
- The Second Derivative Condition (Hessian Matrix): To confirm it is a local minimum, you analyze the curvature in a neighborhood of the point.
- The Hessian Matrix () has all the second partial derivatives. This matrix must be positive definite. This means that no matter which direction you look inside your localized neighborhood ball, the ground curves upward away from x.
- In an -dimensional space, the Hessian is a square symmetric matrix :
- The Diagonal Terms (): Measure how the slope is curving if you walk strictly parallel to one of the main coordinate axes. - The Cross Terms (): Measure how the slope changes in one direction as you move in a different direction (the twist or rotation of the terrain).
The Sufficient Second Order Conditions for a local minimum:
Let be twice differentiable with and let be positive definite. Then is a local minimum of .
For a symmetric matrix (Hessian ) to be positive definite, it must satisfy for every non-zero vector :
- : A vector representing a step in any random direction you choose to walk inside your localized neighborhood ball.
- : Multiplies your step direction by the curvature matrix, figuring out how the slopes alter along that specific path.
- is a specific, fixed coordinate in your parameter space where you are currently standing. It is the exact point you are testing to see if it is a local minimum.
- The in is a variable vector representing a step in any arbitrary direction away from your anchor point .
The resulting output () is a single scalar number that represents the directional second derivative.
- If this value is strictly greater than zero () for every single possible vector , it means that no matter which compass heading you choose to step toward, the slope immediately starts tilting upward Caveat : If you find a local minimum, its Hessian matrix does not have to be strictly positive definite.
- If It is guaranteed to be a local minimum (Sufficient).
- If it is a local minimum can be OR it can be exactly (like ).
Because derivatives only look at an infinitely small neighborhood (), passing these tests only proves you are at the bottom of a valley. It does not tell you if there is a much deeper valley somewhere else on the map. To guarantee a global optimum we must look at the convexity condition.
Constrained Optimization The optimal points lie on the boundaries of the feasible set, not at a local stationary point where the derivative vanishes.
In constrained optimization, the optimal point does not occur at an interior stationary point where . Instead, it lies on the constraint .
At the optimal point , the constraint curve and the level curve of the objective function are tangent to each other. Because they are tangent, their gradient vectors and must be parallel at that point (parallel meaning they lie along the same line, but may point in the same or opposite directions).
This parallelism condition is written as: where is a scalar constant called the Lagrange multiplier. It can be positive or negative depending on whether the gradients point in the same or opposite directions.
The Lagrangian Function
To find the optimal point systematically, we construct the Lagrangian: This reformulates the original constrained problem into an unconstrained one ā we simply look for points where . This gives a system of equations:
Lagrange with One Equality Constraint Theorem: Let be continuously differentiable functions. Let be a local optimum of under the constraint . If , then there exists a Lagrange parameter such that:
If became zero, the boundary line would disappear into a flat plain, making it impossible to align vectors. This requirement is called a Constraint Qualification.
The geometric intuition behind finding an optimum for functions in two variables (). Contour lines (level curves) for the objective function at various values (e.g., , , f=2f=3h(x, y) = 0$.

- Transverse Intersections (Not Optimal): The notes point to a location where the constraint curve simply crosses through the level curves of (like and ). At these intersections, the text explains: āThis will not be a local optimum of under constraints , bcz we can move along and decrease/increase .ā If the curves cross transversally, you can simply slide along the path to reach a lower or higher contour line of .

- Tangential Intersections (The Optimum): The diagram highlights a specific point where the level curve merely touches the constraint curve without crossing it. At this point, the gradient vectors and are drawn pointing in parallel/anti-parallel directions.

To solve a constrained problem via Lagrange multipliers, we match our equations to our unknowns:
- Vector Alignment: yields equations.
- Constraint Boundary: yields additional equation.
- Total: equations for unknowns (the vector coordinates and the scalar ).
Steepest Descent When analytical solutions are impossible, we use a step-by-step algorithm to approximate local optima:
- Initialize: Choose an arbitrary starting point .
- Direction Selection: At your current position , calculate a downward search direction vector such that the function decreases:
- Position Update (The Step): Compute your next location using the update rule: Where is the step length (Learning Rate).
- Termination: Halting criteria triggers when the gradient norm approaches zero ().
The absolute best direction is the negative gradient ().
- Given a smooth, differentiable function .
- At a position where the ground is not flat: .
- Pick an arbitrary direction vector $g \in \mathbb{R}^n$$$ \sqrt{g^T g} = |g| = 1$$
- The directional derivative of in into direction is
- To find the steepest descent, we want to find the direction that makes this directional derivative as small (as deeply negative) as possible
- The first-order Taylor expansion approximation: We have a constrained optimization problem where the step direction is the variable we want to solve for. The Objective Function: (Goal is to minimize this function) The Constraint ():
Plugging these into the Lagrange formula ():
This equation tells us that the optimal step direction must point along the exact same line as our gradient vector . Because our constraint forces the length of to be exactly ()
From our original equation We get
- The Uphill Direction :
- The Downhill Direction :
To find out which one minimizes our objective function, we plug both options back into our directional derivative :
-
If we plug in Option 1, we get a positive number (steepest ascent).
-
If we plug in Option 2, we get a negative number: (steepest descent).
-
-
The raw gradient vector naturally points straight uphill (steepest ascent). A negative sign flips the arrow completely around so it points straight downhill (steepest descent).
Steepest descent is an important iteration procedure which is for example used in the Backpropagation algorithm.
As you cannot analytically calculate the perfect weights for a neural network all at once. Instead, you map out a massive error landscape called a Loss Function, .
- The Forward Pass: The network makes a prediction, and you calculate the total error ( in your notes represents this loss value).
- The Backward Pass (Backpropagation): The algorithm uses the chain rule to compute the exact partial derivatives of that error with respect to every single weight in the model. This compiles the giant gradient vector, .
- The Step (Steepest Descent): We then flips that gradient vector around to find the direction of steepest descent () and shifts the weights of the network a tiny fraction in that direction to minimize the error.
Optimization Under Inequality Constraints : Karush-Kuhn-Tucker (KKT) Conditions
When optimizing an objective function subject to inequality constraints , the feasible region is defined by a set of inequalities. To characterize the local optima within this region, the classical Lagrange multiplier approach is generalized into the Karush-Kuhn-Tucker (KKT) conditions.
Simple Analogy : When a constraint is an equality (), you are forced to walk exactly on top of a thin fence. When a constraint is an inequality (), you are dealing with an entire allowable region (a yard). You can walk anywhere inside the yard (), or you can walk right up against the perimeter fence ().
At any candidate local minimum , the constraint set is partitioned based on the evaluation of :
-
Active Constraints (): Defined as . The candidate point lies exactly on the boundary of these constraints.
-
Inactive Constraints: Constraints where . The candidate point lies strictly in the interior of the feasible region with respect to these boundaries.
-
Regularity Condition (LICQ): We assume the Linear Independence Constraint Qualification holds; specifically, the gradients of all active constraints, , are linearly independent.
- The Linear Independence Constraint Qualification (LICQ) is a regularity condition in nonlinear optimization. At a feasible point xā for a problem with equality constraints h(x)=0 and inequality constraints , LICQ holds if the set of gradients of all equality constraints and of all active inequality constraints is linearly independent.
- When LICQ holds at a local minimizer, KKT multipliers exist and are unique.
The Stationarity Condition : At a local minimum , the gradient of the objective function must be equal to a linear combination of the gradients of the active constraints:
- : The gradient vector of your objective function. It points in the direction of steepest ascent.
- : The gradient vectors of your active constraints (the boundaries you are physically touching).
- : The scaling weights (Lagrange multipliers) for those active constraints
- Non-Negativity of Multipliers: Unlike equality constraints, the KKT multipliers for inequalities must be non-negative (). This ensures that the gradient of the objective function is opposed exclusively by vectors pointing inward toward the feasible region, preventing further descent.
To unify the stationarity condition across the entire constraint set (without explicitly partitioning ), we introduce the Complementary Slackness condition:
- If a constraint is inactive (, If there is Slack), its corresponding Lagrange multiplier must be strictly zero (), eliminating its gradient from the stationarity equation.
- If a constraint is active (), its corresponding Lagrange multiplier may be positive ().
Identifying exactly which constraints belong to the active set beforehand is computationally difficult for a computer.
By enforcing Complementary Slackness (), we donāt have to partition the constraints into āactiveā and āinactiveā sets. We can rewrite the earlier stationarity condition to sum over every single constraint in the entire system (the set ):
An active inequality constraint is simply a temporary equality constraint that only works in one direction.
If your algorithmās objective function gradient is trying to drag you into the wall, the wall pushes back (μ>0). But if your algorithm decides to turn around and walk back into the grass, the wall instantly stops affecting you, the constraint becomes inactive, and its multiplier drops to zero (μ=0).
Convexity If an optimization problem is convex, it is mathematically guaranteed that any local minimum is also the absolute global minimum.
To prove an optimization problem is convex, you must prove two things:
- The feasible region is a Convex Set.
- The objective function is a Convex Function.
Theorem: Let be a convex set, and be a convex function. Then, every local minimum of on is strictly also a global minimum.
Formal Proof (By Contradiction)
Suppose is a local minimum of . By definition, there exists a local neighborhood (a ball ) around such that for all points inside that neighborhood, is the lowest point: Suppose for the sake of contradiction that is not the global minimum. This means there must exist some other point that is strictly lower: Because is a convex set, the line connecting and lies entirely within . Let us pick a point on this line that is close enough to that it falls inside our local neighborhood :

Because is a convex function, we apply Jensenās inequality to our point :
Because our assumption in Step 2 stated that , we can replace with to make the right side of the equation strictly larger:
We have just proven that for a point inside the neighborhood . However, this fundamentally contradicts our starting definition that is the local minimum of . Because this contradiction exists, our assumption that a lower point exists must be false. Thus, the local minimum must be the global minimum.
The First-Order Characterization:Ā A differentiable function is convex if and only if
its graph lies strictly on or above all of its tangent hyperplanes.
f(x) ā„ f(xā) + f'(xā)(x - xā)

For non-convex functions, is merely a necessary condition for a local minimum. For convex functions, it is both necessary and sufficient for a global minimum.
This proves that making a local linear approximation of a convex function always safely underestimates the actual cost.
Linear constraints () form convex feasible regions (polyhedrons), and linear objective functions () are convex, the entire Linear Programming problem is convex.
The Fundamental Theorem of Linear Programming.
If a linear programming problem has an optimal solution and its feasible region is non-empty and bounded (or more generally, if an optimum exists), then: At least one optimal solution occurs at a vertex (extreme point) of the feasible polytope.
Because both your goal (the tilted floor) and your boundaries (the straight fences) are strictly linear, the absolute lowest or highest point is mathematically guaranteed to be at an extreme point (a corner)

- The purple arrow represents the direction that āincreasesā the cost. Since we want toĀ minimizeĀ cost, we want to go in the exact opposite direction.
- The dashed red line represents all the points in the universe that share the exact same cost right now. It sits perfectly perpendicular to the cost vector.
- The linear function we are trying to minimize () is perfectly flat and straight, like a tilted floor. Because it doesnāt have any curves, bowls, or dips, a ball rolling on this floor will never stop in the middle of the yard. It will always keep rolling downhill until it hits a wall
- The fences () are also perfectly straight lines. There are no curved walls to gently cradle the ball.
The Quadratic Function () : The function is convex if and only if the matrix is Positive Semi-Definite (PSD). The shape of the landscape is dictated entirely by the matrix .
Trying to minimize a general quadratic function over a positive boundary () is NP-hard if is not restricted to being Positive Semi-Definite.
The Least Mean Square (LMS) Algorithm :
The algorithm relies on the Adaptive Linear Element (ADALINE) architecture:
- Input Layer: neurons receiving input vector .
- Output Layer: single continuous neuron.
- Weights: Vector . No bias term is used.
- Activation Function: Linear identity function .
- Forward Pass (Prediction):
The LMS algorithm processes streaming data in discrete timesteps ():
- Inputs: Randomly sampled vectors .
- Targets: The desired true scalar value .
- The underlying probability distribution governing how and are generated is strictly unknown.
The Objective Function : At each timestep , the current weight vector is used to approximate the target
- The Instantaneous Error ():
- and are drawn from an unknown probability distribution, the squared error is a random variable.
- The Optimization Goal: The algorithm seeks to adjust the weights to minimize the Expected Squared Error:
LMS is a quadratic optimization problem :
The weights are constants that we control at any given step, the expectation only acts on the random data variables ( and ):
We have a multi-dimensional quadratic polynomial equation:
- The Quadratic Matrix (): (Correlation Matrix of the input signals, in ).
- The Linear Vector (): (Cross-Correlation Vector) between the input signals and the true target. It determines where the center of the bowl shifts in space.
- The Constant (): is simply the total power of the target signal.
A quadratic problem is only efficiently solvable (convex) if the matrix is Positive Semi-Definite (PSD).
For any arbitrary vector :
The matrix is guaranteed to be Positive Semi-Definite. LMS forms a perfect, error-free convex bowl with a single global minimum. The steepest descent algorithm will never get trapped.
Stationarity Assumption : For the expectation operator to be valid over time, we must assume the data stream is Wide-Sense Stationary. The statistical properties (mean and variance) of the random input vectors and the targets do not shift or change as time progresses.
Assuming the correlation matrix is invertible (meaning the inputs are not perfectly redundant)
Wiener-Hopf Solution: Computing the inverse of a massive matrix () takes an incredible amount of computer memory and processing time. To bypass the matrix inversion bottleneck, we apply the Steepest Descent algorithm. Instead of calculating the inverse, the algorithm iteratively updates the weights by stepping in the opposite direction of the gradient.
The Iterative Solution (Gradient Descent) :
- The Gradient:
- The Update Rule: is the learning parameter
Because the objective function is strictly convex (as is Positive Semi-Definite), this gradient descent formulation is mathematically guaranteed to converge to the true Wiener-Hopf solution (), provided that the learning parameter is chosen correctly (neither too large nor too small).
Problem : As we donāt know the probability distribution, we literally cannot calculate or (in either the Wiener-Hopf inverse matrix or the Gradient Descent loop).
-
Estimation Approach (Batch Gradient Descent) : Collect a massive batch of data points (size ). You take all those samples and average them together to create āfakeā versions of and . While the Law of Large Numbers guarantees these converge to the true and as , It requires storing millions of data points in memory and waiting incredibly long times before you can take a single step downhill.
-
Estimated Autocorrelation:
-
Estimated Cross-Correlation:
-
-
The Widrow-Hoff Approach (Stochastic Gradient Descent) : Use the one single data point we have right now ( and ). We drop the Expectation operator entirely and calculate the instantaneous squared error for the single incoming data point:
-
The Gradient:
$\varepsilon\!\left(x^{(k)}\right) = d^{(k)} - w^T x^{(k)}$ $\varepsilon^2\!\left(x^{(k)}\right) = \left(d^{(k)} - w^T x^{(k)}\right)^2$ $\nabla_w \varepsilon^2\!\left(x^{(k)}\right) = 2\left(d^{(k)} - w^T x^{(k)}\right)\nabla_w\!\left(d^{(k)} - w^T x^{(k)}\right)$ $\nabla_w\!\left(d^{(k)} - w^T x^{(k)}\right) = -x^{(k)}$ $\nabla_w \varepsilon^2\!\left(x^{(k)}\right) = 2\left(d^{(k)} - w^T x^{(k)}\right)\left(-x^{(k)}\right)$ $\boxed{\nabla_w \varepsilon^2\!\left(x^{(k)}\right) = -2\,\varepsilon\!\left(x^{(k)}\right)x^{(k)}}$
-
- The Update Equation: Substituting this into the standard steepest descent formula () : w^{(k+1)} = w^{(k)} - \eta \cdot [ \text{Gradient} ]$$$$w^{(k+1)} = w^{(k)} + 2 \cdot \eta \cdot \varepsilon(x^{(k)}) \cdot x^{(k)} The algorithm operates strictly on-line. It integrates new data points one at a time and adapts the weights instantly without needing prior knowledge of the environmentās probability distribution. (āGoldfishā Algorithm (Read, Update, Delete))
Brownian Motion: The trajectory of the weight vector forms a stochastic process. The sequence of updates resembles Brownian motion (a random walk) as it navigates the error surface. Convergence: Due to this stochastic noise, the weights do not perfectly freeze at the absolute minimum . Instead, the algorithm converges in the mean, meaning the expected value of the weights approaches the optimal Wiener-Hopf solution: .
For the LMS algorithm to remain stable and converge (in the mean) to the optimal solution, the fixed learning parameter must satisfy a strict boundary condition:
- is the largest eigenvalue of the true autocorrelation matrix (representing the steepest curve of the quadratic bowl).
Because the underlying distribution is unknown, (and thus ) is generally unknown. Therefore, must be tuned empirically in practice to ensure it doesnāt exceed this hidden boundary and cause the algorithm to diverge. While the theoretical derivation of the objective function assumed a stationary environment, the iterative, memory-less nature of the LMS update rule allows it to effectively track optimal weights in non-stationary environments (where the underlying data distribution slowly shifts over time).
Example Least Mean Square (LMS) algorithm is most famous: Signal Processing and Active Noise Cancellation A pair of noise-canceling headphones has a version of the LMS algorithm running.
The Streaming Input () : At timestep ).
The ADALINE chip inside the headphones takes that raw noise and multiplies it by its current weight (). This calculation generates a new sound wave (the āanti-noiseā) and immediately plays it through the speaker into your ear. The anti-noise is the prediction: .
The ātrue targetā for noise cancellation is (Silence)
Error: (Target Silence - Actual Leftover Hum).
The LMS algorithm takes that tiny error, tweaks its weights just a fraction of an amount, and gets ready for Millisecond 2 ().
The headphones do not have the complex aerodynamic physics equations of a Boeing 737 jet engine programmed into them. The probability distribution of the engineās roar is completely unknown. The headphones also donāt know the exact physical shape of your unique ear canal. By processing the stream of data one discrete timestep at a time. The LMS algorithm adapts and within a few hundred milliseconds, it figures out the pattern, the error drops to zero, and the airplane goes silent.
