How to Calculate the Subgradient?
A subgradient is a generalization of the gradient for non-differentiable convex functions. Below are key cases for finding subgradients.
1️. Subgradient of a Weighted Sum
Let
If we define:
then the subdifferential is:
🔹 Key Insight: The subgradient of a weighted sum of convex functions is the weighted sum of their subgradients.
2️. Subgradient of the Maximum Function
Let
Then, the subdifferential is given by:
where conv denotes the convex hull of the union of all subgradients.
Convex Combination of Subgradients
For any set of subgradients
where:
🔹 Key Insight: The subgradient of
3️. Subgradient of a Scaled Function
If
then the subdifferential satisfies:
🔹 Key Insight: Scaling a function by
Summary
| Function | Subdifferential |
|---|---|
| Sum: |
|
| Max: |
|
| Scaling: |
These rules are essential when dealing with non-smooth convex optimization problems! 🚀
1D Examples
Example 1: Absolute Value Function
Consider the function:
This function is not differentiable at
🔹 Interpretation: At
Example 2: Maximum of Two Linear Functions
Consider:
-
If
, then and . -
If
, then and . -
If
, then , so:
🔹 Interpretation: The function takes the gradient of the active branch, but at
2D Examples
Example 3: Euclidean Norm Function
Consider the function:
which is the Euclidean norm (distance from the origin). The gradient is:
At the origin
🔹 Interpretation: The subgradient at the origin includes all points inside the unit disk.
Why is the subgradient the unit ball?
Since the function is convex, we can use the subgradient definition:
The subdifferential at
Substituting
By the Cauchy-Schwarz inequality, this holds if and only if:
Thus, the subgradient at
Example 4: Maximum of Two Planes
Consider:
-
If
, then and . -
If
, then and . -
If
, then the subgradient is:
which is the set of points:
🔹 Interpretation: At points where
Summary of Key Results
| Function | Subgradient |
|---|---|
These examples illustrate how subgradients generalize gradients for non-differentiable convex functions. 🚀