nyuuzyou/wikis huggingface dataset:
Sec2Sess24

Function of 1 variable
f(x) = sin(x)
Function of 2 variables
given (x,y) -> get a number f(x,y)
Example
f(x,y)\ =\ x^2\ +\ y^2
functions can be defined only in limited domains
f(x,y) = sqrt(y) is only defined when y >= 0
f(x,y) = 1 / x+y only if x+y <> 0
Example
f(x,y) = temperature at point (x,y)
or...3 or more parameters!
For simplicity, focus mostly on 2 (or 3) variables
How to visualize function of 2 variables?
-> graph
z = f(x,y)
Example: f(x,y)=-y
graph: z=-y
\mathrm{Example\ 2:\ f(x,y)\ =\ 1-x^2-y^2}
intersections:
-> in yz-plane
x=0,\ z=1-y^2
-> in xz-plane
y=0,\ z=1-x^2
-> in xy-plane
\mathrm{z=0,\ 1-x^2-y^2=0,\ x^2+y^2=1,\ a\ unit\ circle}
Graphing:
The yz-traces are those curves found by setting x = a constant.
Traces where z = constant are generally called "level curves".
variable that are not a part of the graph equation can change and don't change the shape of the graph. They can shift the position of the graph shape along the axis of the variable by changing the variable's value
shape terminology list:
https://ocw.mit.edu/courses/mathematics/18-02sc-multivariable-calculus-fall-2010/2.-partial-derivatives/part-a-functions-of-two-variables-tangent-approximation-and-optimization/session-24-functions-of-two-variables-graphs/MIT18_02SC_notes_14.pdf
Sec2Sess25

contour plot
curves represent elevations
it is the same as cutting the graph by horizontal planes
example
f(x,y) = -1
when y = 1, x = x and y = -1
when y = -1, x = x and y = 1
graph: creates lines with x-axis in a strait line with y-axis constant
\mathrm{f(x,y)\ =\ 1\ -\ (x^2+y^2)}
\mathrm{when\ f\ =\ 0,\ x^2+y^2=1}
\mathrm{f\ =\ 1\ when\ x^2+y^2=0}
graph: creates circles expanding out from 0,0
circles expand slower the further from origin
y^2-x^2
graph x-shape. becomes more curved as lines expand outward with increasing z-values.
creates saddle shape when viewed at a 3d angle.
recitation 1 examples
b.)\ z\ =\ x^2\ +\ y^2
bowl shape with bottom at <0,0,0> origin
"Saddle point" is between 2 maxima or minima occurring on the sides of it in a saddle graph
Sec2Sess26

in direction f() travels when it increases or decreases, as seen on a graph,
indicates the effect changing x and y will have. The f() will have the effect
produced on it.
Approximation formula
x_0\ -> \ f(x_0)
f(x)\ \approx \ f(x_0)\ +\ f'(x_0)(x-x_0)
continues onto the taylor approximation
how can we approximate two variables?
"partial derivative" notation is a curly "d".
not a full derivative but contain only derivatives for specific variables.
Therefore "partial" rather than "whole" derivative.
A derivative is taken of one veritable but another is kept constant.
Calculated by holding one variable fixed and differentiating with respect
to the other variable.
example
f(x,y)\ =\ x^3*y\ +\ y^2
pd = "partial derivative"
pd(x)\ =\ 3x^2*y\ +\ 0
pd(y)\ =\ x^3\ +\ 2yz
in a pd(x,y) calculation first the pd(x) is taken and then using
the result pd(y) is taken
for all polynomial functions and all differentiable functions of several
variables that will be considered in the class pd(y,x) = pd(x,y).
recitation 1:
x\ *\ y^2\ +\ x^2\ *\ y
a) pd(x), pd(y), pd(x)(1,2)
b) pd(x), pd(x,y), pd(y,x)
a)\ y^2\ +\ 2xy,\ 2yx\ +\ x^2,\ 2^2\ +\ 2*1*2\ =\ 8
b)
pd(x)
y^2\ +\ 2xy
pd(y) on remainder
= 2y+2x
answers = 2y, 2y+2x, 2y+2x
Sec2Sess27

Approximation formula:
If we change:
\mathrm{x\ } -> \mathrm{\ x\ +\ change_x}
\mathrm{y\ } -> \mathrm{\ y\ +\ change_y}
\mathrm{w=f(x,y)\ then\ change_w \approx f_x*change_x+f_y*change_y}
Justify the formula: tangent plane to w=f(x,y)
know: f(x),f(y) are slopes of 2 tangent lines
Combining planes:
pd(x)(x_0,y_0)=a\ =>\ L_1\ =\ {w=w_0+a(x-x_0),\ y=y_0}\ (1st\ plane)
pd(y)(x_0,y_0)=b\ =>\ L_2\ =\ {w=w_0+b(y-y_0),\ x=x_0}\ (2cnd\ plane)
\mathrm{L_1,\ L_2\ are\ both\ tangent\ to\ the\ graph\ w\ =\ f(x,y)}
Together they determine a plane:
\mathrm{w=w_0+a(x-x_0)+b(y-y_0)}
the approximation only works well for small delta x and small delta y
Approximation formula says: the graph of f is close to its tangent plane.
* The most important use for the tangent plane is the give an approximation that is the
basic formula in the study of functions of several variables - almost everything follows
in one way or another from it.
general equation of a plane through (x_0,y_0,w_0) is:
A(x\ -\ x_0)+B(y\ -\ y_0)+C(w\ -\ w_0)\ =\ 0\ .
Assuming plane is not vertical, C <> 0, divide through C to solve for w - w_0
w\ -\ w_0\ =\ a(x-x_0)+b(y-y_0)\ a=A/C,\ b=B/C.
"Linearization" of f(x,y)\ at\ (x_0,\ y_0)
f(x,y)\ \approx\ w_0+pd(x)(x-x_0)+pd(y)(y-y_0)
linear function with best approx. to f(x,y) for (x,y) close to (x_0,y_0)
the change (change over time) notation has an equivalent form:
\mathrm{change_w\ \approx\ pd_0(x)*change_x+pd_0(y)*change_y\ if\ change_x\ \approx\ 0,\ and\ change_y\ \approx\ 0}
for 3 variables:
w = f(x,y,z)
\mathrm{change_w\ \approx\ pd_0(x)*change_x+pd_0(y)*change_y+pd_0(z)*change_z\ if\ change_x,\ change_y,\ change_z\ \approx\ 0}
Beyond 3 variables the approximation formula does not work well.
Example 1
reasonable square at (1,1) over w=x^3y^4 does not vary more than +/- .1
pd(x)=3x^2*y^4\ ,\ pd(y)\ =\ 4x^3*y^3
x_0\ =\ 1,\ y_0\ =\ 1
\mathrm{change_w\ \approx\ pd_0(x)*change_x+pd_0(y)*change_y}
apply (x_0,y_0) to pd(x) and pd(y)
change_w\ \approx\ 3*change_x+4*change_y
plug in values to make change_w\ <=\ .1
change_x,\ change_y\ <=\ .01 work due to:
.07\ \approx\ 3*.01+4*.01
answer is therefore square at center (1,1) with:
|x-1|<= .01 and |y-1|<= .01
Which variable causes greatest results change:
Sensitivity Principle: The numerical value of w = f(x,y,...) calculated
at some point (x_0,y_0,...), will be most sensitive to small changes in
that variable for which the corresponding partial derivative w_x,w_y,...
has the largest absolute value at the point.
NOTE: the largest absolute value seem to occur because taking the partial
derivative of the variable that contributes the least to the total leaves
the rest of the greatest contributing variables without their derivative
taken and makes that point contribute the most.
Area and other functions can be found with formula:
\mathrm{f(x,y)\ \approx\ w_0+pd(x)(x-x_0)+pd(y)(y-y_0)}
For example take (X_0,y_0) and use it in the formula with (x,y) to get
area solution. w_0 can be found as x*y in area formula (A=x*y)
Sec2Sess28

\text {Application of partial derivatives: } 
 \text {Optimization Problems } 
find min/max of a function f(x,y)
At a local min. or max; pd(x) = 0 and pd(y) = 0
\mathrm{change_z\ \approx\ f_x*change_x+f_y*change_y}
<=> tangent plane to graph z:f(x,y) is horizontal!
\mathrm{z = z_0 + a(x - x_0) + b(y - y_0)}
becomes
\mathrm{z = z_0 + 0 + 0}
Definition: (x_0,\ y_0) is a critical point of f
if pd(x) = 0 and pd(y) = 0
a.k.a. all partial derivatives are 0
Example: \mathrm{f(x,y)\ =\ x^2-2xy+3y^2+2x}
pd(x) = 2x-2y+2 = 0
pd(y) = -2x+6y-2 = 0
sum: 4y = 0
therefore y should be 0
applying y = 0 in pd(x) creates 2x+2=0
* in general solving for exact value of one variable using partial
derivatives and plugging that value into partial derivative of other
variable can solve for the other variable
1 critical point found when (-1,0)
Question it is a max or min?
can be found based on second derivative.
Possibilities:
local min
local max
saddle: neither min or max, center of saddle is not highest or lowest point
\mathrm{f(x,y)\ =\ x^2-2xy+3y^2+2x}
complete the square:
\mathrm{f(x,y)\ =\ (x-y)^2+2y^2+2x+2y}
even further:
\mathrm{f(x,y)\ =\ ((x-y)+1)^2\ +2y^2\ -\ 1}
\mathrm{due\ to\ ((x-y)+1)\ >=\ 0\ and\ 2y^2\ >=\ 0\ the\ result\ of\ f(x,y)\ is\ always\ >=\ 1}
therefore it is a minimum
Sec2Sess29

\text {least-squares interpolation: } 
finding best fit line for y = ax+b (regression line)
unknowns searched for are a and b
method: minimize total square deviation
deviation: difference between observed and predicted points
Main point of lesson: find critical points, i.e., minimums,
for optimization by applying the least squares scoring function
to x and y, finding partial derivatives of the function, and solving
for unknown dependent variables through linear system equations
where the result is 0. The result being 0 causes the derivative
to be at the minimum.
minimize D
D is the sum (where i is 1 to n) of the squared error (deviation)
\mathrm{D\ =\ \sum\limits_{i=1}^n(y_i-(a*x_i+b))^2}
a function of a and b
partial derivatives of a and b
\mathrm{pd(a):\ \sum\limits_{i=1}^n(2*(y_i-(a*x_i+b))*(-x_i))\ =\ 0}
\mathrm{pd(b):\ \sum\limits_{i=1}^n(2*(y_i-(a*x+b))*(-1)\ =\ 0}
expand product of \mathrm{y_i-(a*x_i+b))*(-x_i)}:
remove 2 from the equations because solving linear system
cancels them out
(y-a*x-b)*(-x)
(-a*x-b+y)*(-x)
x^2*a+x*b-x*y
\mathrm{pd(a):\ \sum\limits_{i=1}^n(2*(y_i-(a*x_i+b))*(-x_i))\ =\ 0}
\mathrm{pd(b):\ \sum\limits_{i=1}^n(2*(y_i-(a*x+b))*(-1)\ =\ 0}
expand product of \mathrm{y_i-(a*x_i+b))*(-x_i)\ =\ 0}:
remove 2 from the equations
(y-a*x-b)*(-x)
(-a*x-b+y)*(-x)
x^2*a+x*b-x*y=0
for part_d of b:
xa+b-y=0
x^2*a+x*b-x*y=0 rewritten becomes:
sum(x^2)a+sum(x)b=sum(xy)
part_b rewritten:
sum(x)a+nb=y where n = sample size from \mathrm{\sum\limits_{i=1}^n} function
rewritten equations become linear system
that can be solved for a,b:
xa+xb=xy
xa+nb=y
often dividing all terms by n is done "to make them more expressive".
n = the total number of points (x,y) sampled
second derivative of function finds a minimum values
(inflection point) when derivative is 0.
example application of least squares given sample data if given here:
https://ocw.mit.edu/courses/mathematics/18-02sc-multivariable-calculus-fall-2010/2.-partial-derivatives/part-a-functions-of-two-variables-tangent-approximation-and-optimization/session-29-least-squares/MIT18_02SC_we_13_comb.pdf
Another method:
Line equation used of y = ax+b can be higher order polynomial
if wanted for a more complex line fit. E.g., y = ax^2+bx+c
how to find a best exponential fit:
y = ce^ax where e is natural log
<=> (equivalent to) ln(y)=ln(c)+ax
can be applied to quadratic law.
General method of finding line fit with least squares:
plug points into y = ax+b form. That is rewritten
as y - (ax + b) = 0 . combine results from all points
by adding them together. From results find partial derivative
for a and b. use partial deriv. in linear system to solve for
equations equaling 0 .
a and b values used to solve for 0 are line's coefficients
practice problem example:
https://ocw.mit.edu/courses/mathematics/18-02sc-multivariable-calculus-fall-2010/2.-partial-derivatives/part-a-functions-of-two-variables-tangent-approximation-and-optimization/session-29-least-squares/MIT18_02SC_pb_28_comb.pdf
Sec2Sess32

Unformatted notes below. Notes on my shorthand method
Chain Rule Derivatives and Directional Derivatives
More tools to study derivatives
Differentials
Implicit Differentiation
y = f(x)
dy = f'(x)dx
Example: 
y=sin^-1(x)
x=sin(y) -> dx = cos(y)dy
dy/dx = 1/cos(y) = 1/sqrt(1-x^2)
Total Differential
All the variables that cause change
f(x,y,z)
df = fx*dx+fy*dy+fz*dz
= pd(x)*d(x)+pd(y)*d(y)+pd(z)*d(z)
Important: the total differential is the sum of the
partial derivatives.
Important: d(f) is not the same as change_f
d(f) can be considered a "place holder" for a later value
d(f) can:
1. encode how change in x,y,z affect f.
2. placeholder for small variations change_x, change_y, change_z
to get approximation formula change_f =~ fx*change_x+fy*change_y+fz*change_z
3. divide by something like d(t) to get a rate of change when x=x(t), y=y(t), z=z(t)
Chain Rule = d(f)/d(t) = f(x)*d(x)/d(t)+f(y)*d(y)/d(t)+f(z)*d(z)/d(t) (one instance of the chain rule)
Why is this valid?
1st attempt at validating
df = fxdx+fydy+fzdz
dx=x'(t)dt, dy=y'(t)dt, dz=z'(t)dt
so df = fx*x'(t)dt+fy*y'(t)dt+fz*z'(t)dt
divide by dt => get chain rule.
Better validation
change_f ~= fx*change_x+fy*change_y+fz*change_z (in time change_t)
change_f/change_t ~= (fx*change_x+fy*change_y+fz*change_z)change_t
when change_t -> 0: change_f/change_t -> d(f)/d(t) , change_x/change_t -> d(x)/d(t) , ...
so d(f)/d(t) = f(x)*d(x)/d(t)+f(y)*d(y)/d(t)+f(z)*d(z)/d(t)
~= becomes = in limit change_t->0
example problems:
https://ocw.mit.edu/courses/mathematics/18-02sc-multivariable-calculus-fall-2010/2.-partial-derivatives/part-b-chain-rule-gradient-and-directional-derivatives/session-32-total-differentials-and-the-chain-rule/MIT18_02SC_we_15_comb.pdf
Sec2Sess33

Unformatted notes below. Notes on my shorthand method
Chain Rule Examples
Reminder:
Chain rule = (f(g(x)))' = f'(g(x)) * g'(x) where (...)' is the derivative
Example
w = x^2y+z, x=t, y=e^t, z=sin*t
chain rule
dw/dt = 2xy*dx/dt+x^2*dy/dt+1*dz/dt
= 2te^t*1+t^2*e^t+cos*t
= 2te^t+t^2*e^t+cos*t
Substitute: w(t) = x^2*y+z
w(t) = t^2*e^t+sin(t)
dw/dt = 2te^t+t^2e^t+cos(t)
f = uv
u = u(t), v=v(t)
d(uv)/dt=f(u)*d(u)/d(t)+f(v)*d(v)/d(t)=v*du/dt+u*dv/dt
similarly the quotiant rule can be used
g=u/v u=u(t), v=v(t) d(u/v)/d(t) = 1/v*du/dt+(-u/v^2)*dv/dt = (u'v-v'u)/v^2
Sec2Sess34

Unformatted notes below. Notes on my shorthand method
Chain rule with more variables!
w=f(x,y), where x=x(u,v) and y=y(u,v)
=f(x(u,v),y(u,v))
Question: pd(w)/pd(u), pd(w)/pd(v) in terms of pd(w)pd(x),pd(w)pd(y),x_u,x_v,y_u,y_v
dw = f(x)*d(x)+f(y)*d(y)
= f(x)*(x_u*d_u+x_v*d_v)+f(y)*(y_u*d(u)+y_v*d(v))
= (f_x*x_u+f_y*y_u)*d_u+(f_x*x_v+f_y*y_v)*d_v
pd(f)/pd(u) = (f_x*x_u+f_y*y_u)*d_u
pd(f)/pd(v) = (f_x*x_v+f_y*y_v)*d_v
pd(f)/pd(u) = pd(f)/pd(x)*pd(x)/pd(u)+pd(f)/pd(y)*pd(y)/pd(u)
pd(f)/pd(v) = pd(f)/pd(x)*pd(x)/pd(v)+pd(f)/pd(y)*pd(y)/pd(v)
due to partial derivatives formulas can not be simplified in the way of
cancelling out pd(x) and 1/pd(x) and same for y in the formulas. regular
derivatives can have that simplification.
multiple chain rules can be used sequentially for formulas with that amount
of complication in its variables.
Example:
polar coordinates
x=r*cos(theta)
y=r*sin(theta)
f=f(x,y)
pd(f)/pd(r) = pd(f)/pd(x)*pd(x)/pd(r)+pd(f)/pd(y)*pd(y)/pd(r)=f(x)*cos(theta)+f(y)*sin(theta)
Gradient Vector
a function where its components are the partial derivatives of a function
g=<f_x,f_y,f_z>
it is a way to group partial derivatives
Note: either dependency graph or total differentials methods can be used to find
partial derivatives of problems that have multiple variables, e.g., x,y,z
Sec2Sess35

Unformatted notes below. Notes on my shorthand method
Gradient, definition and perpendicular to the level surface
Recall Chain Rule
w = w(x,y,z)
x=x(t)
y=y(t)
z=z(t)
dw/dt=wx*dx/dt+wy*dy/dt+wz*dz/dt
dw/dt = g(w) . d(->_r)/d(t) where g() is the gradient,
"." is the dot product, and ->_x is the velocity vector
g(w) = <wx,wy,wz>
GRADIENT OF W at some point (x,y,z)
later this will be termed the "vector feild"
d(->_r)/d(t) = <d(x)/d(t),d(y)/d(t),d(z)/d(t)>
Theorem: g(w) is perpendicular to the level surface {w = constant}
It is perpendicular to the level curves in a function such as f(x,y) = c
Example 1:
linear function
w = a1*x+a2*y+a3*z
g(w) = <a1,a2,a3>
a1 = pd(w)/pd(x)
a2 ... etc.
level surface
a1*x+a2*y+a3*z=c , the surface is in the form of a plane
plane with normal vector that is equal to the gradient <a1,a2,a3>
Example 2:
w = x^2+y^2
w=c is a circle when graphed in 2d. center is at 0,0
x^2+y^2=c
g(w) = <2x,2y>
gradient is perpendicular to points along the circumference of
the circle
Sec2Sess36

Unformatted notes below. Notes on my shorthand method
Proof of Gradient Perpendicular to Level Curves and Surfaces
Note from class: Gradient always points towards higher values of a function w.
Therefore it is perpendicular to tangent line of function.
Take a curve r-> = r->(t)
that stays on the level surface
w(x,y,z)=c
velocity vector is tangent to curve of function
w = c for level surface
velocity v-> d(r->)/d(t) is tangent to the level w=c.
By chain rule: dw/dt = g(w) . d(r->)/d(t)
= g(w) . v-> = 0 since w(t) = c = constant
dot product of 0 prooves that vectors are perpendicular
So g(w) is perpendicular to v->
This is true for any motion on w=c. Therefore v-> can
be any vector tangent to w=c and g(w) is still 
perpendicular.
tangent plane to level plane
given any vector v-> tangent to level plane, g(w) is
perpendicular to the tangent plane at that point.
so g(w) is perpendicular to the tangent plane to the level
Sec2Sess37

Unformatted notes below. Notes on my shorthand method
Example: find the tangent plane to surface x^2+y^2-z^2 = 4 at point (2,1,1)?
Level set w=4, where w=x^2+y^2-z^2.
Note: "level set" is result of the tangent plane to surface equation.
gradient: g(w) = <2x, 2y, -2z>
normal vector = <4,2,-2> when point (2,1,1) is applied
so eq. is 4x+2y-2z=8 because when point (2,1,1) is applied
to 4x+2y-2z than the result is 8.
Another way:
dw= 2xdx+2ydy-2zdz
= 4dx + 2dy - 2dz (at (2,1,1))
change_w ~= 4*change_x+2*change_y-2*change_z
replace function by tangent approximation
So: level: change_w = 0
its tangent plane: 4*change_x+2*change_y-2*change_z=0
= 4(x-2)+2(y-1)-2(z-1)=0
Example problems:
https://ocw.mit.edu/courses/mathematics/18-02sc-multivariable-calculus-fall-2010/2.-partial-derivatives/part-b-chain-rule-gradient-and-directional-derivatives/session-37-example/MIT18_02SC_we_17_comb.pdf
https://ocw.mit.edu/courses/mathematics/18-02sc-multivariable-calculus-fall-2010/2.-partial-derivatives/part-b-chain-rule-gradient-and-directional-derivatives/session-37-example/MIT18_02SC_pb_44_quest.pdf
Sec2Sess38

directional derivatives
the directional deriv of function w is the change in w caused by a movement (step) of length s in the direction of u (1 unit length vector) coming out of the point on a plane p_0.
d(w)/d(s)|p_0,u = grad(w)*p_0 dot_product u
example
find dir deriv
take gradient of function and apply it to point values. take the dot product of that result with the unit vector. if provided a direction (v) find the unit vector by u = v/|v| where |...| is the determinant
the directional derivative in the same direction as w is the direction of greatest change. that can be found in the following equation when angle = 0 in the cosine function. that greatest change can also be considered the greatest increase in a function. the greatest decrease in the function can be found by -1*grad(w).
d(w)/d(s)|u=grad(w) dot_prod u = |grad(w)||u|cos(@)=|grad(w)|cos(@) where |u| cancels out due to being 1 and @ is the angle
important distinction: upside down triangle is gradient symbol, right side up triangle is change symbol
distance traveled along a directional derivative can be.found by applying the rate of change found with the gradient to the number of movement steps taken at that change rate. time units can be a type of steps taken along a direction.
Sec2Sess40

Unformatted notes below. Notes on my shorthand method
Session 40: Proof of Lagrange Multipliers
Why are Lagrange Multipliers valid?
At constrained min/max, in any direction along the level set g=c the rate of change of f must be 0.
For any \hat{u} tangent to g=c (constraint) we must have df/ds(\hat{u}) = 0 = grad(f)*\hat{u} where df/ds(\hat{u}) is df/ds in the direction of \hat{u}
So any such \hat{u} is perpendicular to grad(f) because grad(f) is perp. to the level set of g
Another vector is perp. to the level set of g, that vector is grad(g). Therefore grad(f) is parallel to grad(g).
Warning: method does not tell if a solution is min or max
The second derivative test is not able to be used to find mix or max also.
Values can be compared to investigate if critical points are min or max. Look at solutions and see which ones produce the highest and lowest values.
To find min (or max) we compare values of f at the various solutions to Lagrange equations. In some cases the answers can be found by thinking geometrically, looking for which points are closest to the origin.
Description of finding critical points: for the function w = f(x,y,z) constrained by g(x,y,z) = c (c a constant) the critical points are defined as those points, which satisfy the constraint and where grad(f) is parallel to grad(g). In equations:
grad(f)(x,y,z) = lamda*grad(g)(x,y,z) and g(x,y,z) = c.
Sec2Sess41

Unformatted notes below. Notes on my shorthand method
Session 41: Advanced Example
Want to build a pyramid with a given triangular base and given volume
Where to put the top of the pyramid is the method.
Goal is to minimize the total surface area.
Vol = 1/3*area(base)*height
In this problem the height is fixed
The problem could be described as: P1 = (x1,y1,0), P2 = (x2,y2,0), P3 = (x3,y3,0), 
P = (x,y,h) where P1,P2,P3 are points on the triangle sides and P is the point on
the top.
Finding the solution is too complicated for directly using cross product formulas.
Pyramid Area = sum of 3 triangle bases * 3 heights
Q (x,y,0) is center point of bottom triangle in pyramid
u1, u2, and u3 are distances from Q to the center of the sides of the bottom triangle
Area of triangle with points P, Q, and u1 is sqrt(u1^2+h^2)
these triangles are "face triangles"
Side area = 1/2*a1*(u1^2+h^2) + 1/2*a2*(u2^2+h^2) + 1/2*a3*(u3^2+h^2)
a function of 3 variables = f(u1,u2,u3)
cut base into 3 => Area(base) = 1/2*ai*u1+1/2*a2*u2+1/2*a3*u3
for lagrange multiplications g/(Area(base))
grad(f) = lamda*grad(g): pd(f)/pd(u1)=1/2*a1*u1/sqrt(u1^2+h^2) = lamda*1/2*a1
1/2*a1 cancels out on both sides of the equation leaving
pd(f)/pd(u1)=u1/sqrt(u1^2+h^2) = lamda
equations are the same for u2, u3, etc. Because all equations equal lamda then
u1 = u2 = u3
Therefore Q is equidistant from all sides and is named the "incenter"
Example Problem:
Find the maximum and minimum values of the function f(x,y,z) = x^2+x+2y^2+3z^2
as (x,y,z) varies on the unit sphere x^2+y^2+z^2=1
Method: find points where the gradient of the objective function is parallel to the 
constraint function. 
pd(x) = 2x+1=lamda*2x
pd(y) = 4y = lamda*2y
pd(z) = 6z = lamda*2z
x^2+y^2+z^2=1
2cnd equ. (for y): for result of 0: y=0 or lamda = 2
3rd equ. (for z): z=0 or lamda=3
Solutions:
a) y=z=0 => x=1 or x=-1 (1,0,0),(-1,0,0)
b) y=0,lamda=3 => x=1/4,z=+/-sqrt(15)/4 creates (1/4,0,sqrt(15)/4),(1/4,0,-sqrt(15)/4)
c) lamda=2,z=0 => x = 1/2, y = +/- sqrt(3)/2 creates (1/2,sqrt(3)/2,0),(1/2,-sqrt(3)/2,0)
applying the solution points shows where the function f is maximized
a) creates function values 2 or 0, b) 25/8 c) 9/4
looking at the value the min+max can be found. min value of f is 0 and 25/8 is the max.
overall method: solve system of equations from partial derivatives to find solutions. 
Use solutions in function to find min/max result values.