1.2.4 · HinglishCalculus & Optimization Basics

Gradients and directional derivatives

1,432 words7 min readRead in English

1.2.4 · AI-ML › Calculus & Optimization Basics


KIYA hai partial derivative (building block)

Baaki ko constant kyun maante hain? Kyunki partial derivative change ko ek coordinate axis ke saath measure karta hai. East ki taraf chalna tumhe north slope ke baare mein kuch nahi batata, isliye hum north ko freeze kar dete hain.


KIYA hai gradient


KAISE derive karte hain directional derivative

Goal: ki change ki rate agar hum point se unit direction mein move karein (jahan ).

Us direction ke saath ek 1-D slice define karo: Directional derivative bas hai — us slice ka ordinary 1-D derivative.

Chain rule apply karo. Maano , toh aur :

Yeh sum bilkul ek dot product hai:


KYUN gradient steepest uphill point karta hai

Dot product ko geometric form mein likho: jahan , aur ke beech ka angle hai (aur ).

  • Yeh sabse bada tab hota hai jab , yaani ke saath chalo. → steepest ascent, value .
  • Sabse chhota (sabse zyada negative) jab ke opposite chalo. → steepest descent, isliye gradient descent use karta hai.
  • Zero jab ke perpendicular chalo. → tum level set / contour ke saath chal rahe ho, height unchanged. Toh gradient contour lines ke perpendicular hota hai.
Figure — Gradients and directional derivatives

Worked examples


Common mistakes (steel-manned)


Forecast-then-verify


Flashcards

What is the directional derivative in dot-product form?
with .
Why must be a unit vector?
Taaki result slope ko per unit distance measure kare, vector ki length se scale na ho.
In which direction does point?
Steepest ascent ki direction mein; iska magnitude steepest slope hai.
What is the relationship between and contour lines?
Yeh level sets ke perpendicular (orthogonal) hota hai, kyunki contour ke saath .
Why does gradient descent use ?
steepest descent ki direction hai (), ki sabse tezi se decrease.
Is the gradient a scalar or a vector?
Ek vector jisme har input variable ke liye ek component hota hai.
Derivation: how do we get ?
set karo, chain rule apply karo; .
Max value of over all unit ?
, tab milta hai jab , ke saath align ho.

Recall Feynman: 12-saal ke bachche ko samjhao

Tum ek ulte-seedhe pahaad par ho. Jahan bhi khade ho, ek direction sabse tezi se upar jaati hai — jaise slide ka sabse steep hissa, par upar ki taraf. Gradient bilkul us steepest-up direction mein point karta ek arrow hai, aur arrow ki lambai batati hai kitna steep hai. Agar tum bottom tak pahunchna chahte ho (model train karna), toh hamesha arrow ke ulti direction mein chalo. Aur agar tum arrow ke sideways chalo, toh tum same height par rehte ho — yeh pahaad par ek flat ring ke saath chalna hai.

Connections

  • Partial derivatives — woh components jo banate hain.
  • Chain rule — directional derivative derive karne mein use hota hai.
  • Gradient descent ke saath chalta hai.
  • Level sets and contours — gradient unke orthogonal hota hai.
  • Dot product and projections ke peeche ki geometry.
  • Jacobian and Hessian — higher-order generalizations.

Concept Map

slope along one axis

vector of all partials

1-D slice g of t

chain rule

is a dot product

dot product with u

geometric form

theta equals 0 max

theta equals pi min

points toward

minus nabla f

Partial derivative

Gradient nabla f

g of t equals f of a plus t u

Move in unit direction u

Sum of partials times u_i

Directional derivative D_u f

nabla f times cos theta

Steepest ascent

Steepest descent

Gradient descent in ML