Search Knowledge

© 2026 LIBREUNI PROJECT

Calculus & Analysis / Overview

Mathematical Optimization

Mathematical Optimization

Optimization is the selection of a best element (with regard to some criterion) from some set of available alternatives. In its simplest form, this means finding the values that maximize or minimize a function.

Unconstrained Optimization

For a differentiable function f(x)f(x), local extrema occur at points where f(x)=0f'(x) = 0. The Second Derivative Test determines if a point is a maximum (f<0f'' < 0) or a minimum (f>0f'' > 0).

python
1import numpy as np
2 
3def f(x):
4 return x**4 - 4*x**2 + 3
5 
6def df(x):
7 return 4*x**3 - 8*x
8 
9def ddf(x):
10 return 12*x**2 - 8
11 
12# Roots of df(x) are 0, sqrt(2), -sqrt(2)
13critical_points = [0, np.sqrt(2), -np.sqrt(2)]
14 
15for p in critical_points:
16 second_der = ddf(p)
17 kind = "Min" if second_der > 0 else "Max"
18 print(f"Point x={p:.2f} is a {kind} (f''={second_der:.2f})")

Gradient Descent

In higher dimensions, we often use iterative methods like Gradient Descent to find a local minimum: xn+1=xnγf(xn)\mathbf{x}_{n+1} = \mathbf{x}_n - \gamma \nabla f(\mathbf{x}_n) where γ\gamma is the learning rate.

python
1def f(x, y):
2 return x**2 + y**2 + 10
3 
4def grad_f(x, y):
5 return np.array([2*x, 2*y])
6 
7point = np.array([5.0, 5.0])
8gamma = 0.1
9 
10for _ in range(10):
11 point = point - gamma * grad_f(*point)
12 print(f"Current point: {point}")

If the gradient of a function at a point is (0,0,0), what can we conclude?

Constrained Optimization: Lagrange Multipliers

To optimize f(x,y)f(x, y) subject to g(x,y)=cg(x, y) = c, we look for points where the gradients are parallel: f=λg\nabla f = \lambda \nabla g

What does the Lagrange multiplier lambda represent in economic contexts?

Previous Module Multivariable Calculus