Mathematics, Calculus and Linear Algebra Reference Card
#math #engineering #calculus #latex #refcard #formula
Math and Calculus Cheat Sheet
Related ΒΆ
- LaTeX Refcard
- Matlab(Octave) Programming
- Linear Algebra
- Discrete Mathematics
- Signals and Systems
- Jupyter Notebook
Overview ΒΆ
Tooling
- Python SymPy Computer Algebra System
- Mathics - Lightweight Alternative to Mathematics built on-top of Pyhthon/SymPy
Logic and Proof
Terminology:
- Algorithms
- Axioms
- Conjectures
- Corollaries
- Criteria
- Definitions
- Examples
- Lemmas
- Observations
- Properties
- Propositions
- Proofs
- Remarks
- Theorems
1 Physical Units and SI Prefixes ΒΆ
Fundamental Units of S.I System
Physical Quantity | Unit | Symbol |
---|---|---|
Length | metre | \(m\) |
Mass | Kilogram | \(Kg\) |
Time | Seconds | \(s\) |
Temperature | Kelvin | \(K\) |
Planar Angle | Radian | \(\text{rad}\) |
Main S.I Units
Physical Quantity | Unit | Symbol |
---|---|---|
Force | metre | \(m\) |
Work | Joule | \(J\), \(N.m\) |
Energy | Joule | \(J\), \(N.m\) |
Power | Watt | \(W\) |
Area | square metre | \(m^2\) |
Volume | cubic metre | \(m^3\) |
Pressure | Pascal | \(Pa\) |
Stress | Pascal | \(Pa\) |
Velocity/Speed | meters per seconds | \(m/s\) |
Acceleration | meters per square seconds | \(m/s^2\) |
Angular velocity | radians per seconds | \(rad/s\) |
Angular acceleration | radians per square seconds | \(rad/s^2\) |
Momentum (linear) | Kilogram metre per second | \(Kg m / s\) |
Torque (Moment) | Newton mere | \(N.m\) |
Density | Kilogram/metre3 | \(Kg/m^3\) |
S.I Prefixes
Multiplication Factor | Prefix | Symbol |
---|---|---|
\(10^{12}\) | Tera | \(T\) |
\(10^{9}\) | Giga | \(G\) |
\(10^{6}\) | Mega | \(M\) |
\(10^{3}\) | kilo | \(k\) |
\(10^{2}\) | hecto | \(h\) |
\(10^{1}\) | deca | \(da\) |
\(10^{-1}\) | deci | \(d\) |
\(10^{-2}\) | centi | \(c\) |
\(10^{-3}\) | milli | \(m\) |
\(10^{-6}\) | micro | \(\mu\) |
\(10^{-9}\) | nano | \(n\) |
\(10^{-12}\) | pico | \(p\) |
2 Fundamental Curves ΒΆ
2.1 Line Function ΒΆ
A general line equation has the following format, where \(\alpha\) is the line slope or anglular coefficient and \(\beta\) is the intercept of the line and the Y axis when x = 0.
Given two points of this line equations \((x_1, \, y_1)\) and \((x_2, \, y_2)\), the line equation can be found by using,
so, the line slope coefficient \(\alpha\) is given by,
and the coefficient \(\beta\) can be determined as:
The solution of the line equation \(f(x) = 0\), is the point x where this curve intercepts the \(X\) axis or \(y = 0\). It is observable that this point is:
2.2 Quadratic Equation and Quadratic Curve ΒΆ
A quadratic cuve has the format \(\eqref{EqQuadratic}\), where \(a \in \mathbb{R}\), \(b \in \mathbb{R}\) and \(c \in \mathbb{R}\).
Solution of Quadratic Equation
The solution of the quadtratic equation \(f(x) = 0\) can be found as:
Where \(\Delta\) is given by:
Determine Quadratic Equation from Points
Given three distinct points \((x_1, \, y_1)\), \((x_2, \, y_2)\) and \((x_3, \, y_3)\) of a quadratic cuve \(f(x) = ax^2 + bx + c\), the coefficients of the quatratic curve that intercepts those points can be determined by solving the following linear system for the column vector \([a \, b \, c]^T\).
Solve the equation in Python's Sympy
Since this linear system is small, it is worth solving it in symbolic form in order to be able to implement it as software.
Import Sympy and enable pretty printing.
import sympy as sp
sp.init_printing()
Create symbols and matrices.
x1, x2, x3, y1, y2, y3, a, b, c = sp.symbols("x1 x2 x3 y1 y2 y3 a b c")
A = sp.Matrix([[x1**2, x1, 1], [x2**2, x2, 1], [x3**2, x3, 1]])
x = sp.Matrix([a, b, c])
y = sp.Matrix([y1, y2, y3])
Create the equation object. Solve A * x = y
indirectly by converting this equation to sympy standard format eqrhs: A * x - y
, that solves eqrhs == 0
or A * x - y == 0
for x, vector of variables a, b and c.
eq = A * x - y
>>> eq
β‘ 2 β€
β’aβ
xβ + bβ
xβ + c - yββ₯
β’ β₯
β’ 2 β₯
β’aβ
xβ + bβ
xβ + c - yββ₯
β’ β₯
β’ 2 β₯
β£aβ
xβ + bβ
xβ + c - yββ¦
Solve the equation system for a, b and c.
sols = sp.solve([eq[0], eq[1], eq[2]], (a, b, c))
>>> sols[a]
-xββ
yβ + xββ
yβ + xββ
yβ - xββ
yβ - xββ
yβ + xββ
yβ
βββββββββββββββββββββββββββββββββββββββββββββββββββ
2 2 2 2 2 2
xβ β
xβ - xβ β
xβ - xββ
xβ + xββ
xβ + xβ β
xβ - xββ
xβ
>>> sols[b]
2 2 2 2 2 2
xβ β
yβ - xβ β
yβ - xβ β
yβ + xβ β
yβ + xβ β
yβ - xβ β
yβ
βββββββββββββββββββββββββββββββββββββββββββββββββββ
2 2 2 2 2 2
xβ β
xβ - xβ β
xβ - xββ
xβ + xββ
xβ + xβ β
xβ - xββ
xβ
>>> sols[c]
2 2 2 2 2 2
xβ β
xββ
yβ - xβ β
xββ
yβ - xββ
xβ β
yβ + xββ
xβ β
yβ + xβ β
xββ
yβ - xββ
xβ β
yβ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2 2 2 2 2 2
xβ β
xβ - xβ β
xβ - xββ
xβ + xββ
xβ + xβ β
xβ - xββ
xβ
Generate the LaTeX expression for the values of a, b and c.
>>> print(sp.latex(sols[a]))
\frac{- x_{1} y_{2} + x_{1} y_{3} + x_{2} y_{1} - x_{2} y_{3} - x_{3} y_{1} + x_{3} y_{2}}{x_{1}^{2} x_{2} - x_{1}^{2} x_{3} - x_{1} x_{2}^{2} + x_{1} x_{3}^{2} + x_{2}^{2} x_{3} - x_{2} x_{3}^{2}}
>>> print(sp.latex(sols[b]))
\frac{x_{1}^{2} y_{2} - x_{1}^{2} y_{3} - x_{2}^{2} y_{1} + x_{2}^{2} y_{3} + x_{3}^{2} y_{1} - x_{3}^{2} y_{2}}{x_{1}^{2} x_{2} - x_{1}^{2} x_{3} - x_{1} x_{2}^{2} + x_{1} x_{3}^{2} + x_{2}^{2} x_{3} - x_{2} x_{3}^{2}}
>>> print(sp.latex(sols[c]))
\frac{x_{1}^{2} x_{2} y_{3} - x_{1}^{2} x_{3} y_{2} - x_{1} x_{2}^{2} y_{3} + x_{1} x_{3}^{2} y_{2} + x_{2}^{2} x_{3} y_{1} - x_{2} x_{3}^{2} y_{1}}{x_{1}^{2} x_{2} - x_{1}^{2} x_{3} - x_{1} x_{2}^{2} + x_{1} x_{3}^{2} + x_{2}^{2} x_{3} - x_{2} x_{3}^{2}}
Solution:
Code Generation using CSE - Common Subexpression Elimination:
>>> result = sp.Matrix([sols[a], sols[b], sols[c]])
>>> u = sp.numbered_symbols("u")
>>> r = sp.cse(result, symbols = u)
# --- Intermediate Variables -------#
for var, expr in r[0]: print(f" {var} := {expr}")
u0 := x3**2
u1 := u0*x1
u2 := x1**2
u3 := u2*x2
u4 := x2**2
u5 := u4*x3
u6 := u4*x1
u7 := u2*x3
u8 := u0*x2
u9 := 1/(u1 + u3 + u5 - u6 - u7 - u8)
eqq = r[1][0]
# --------- Final Variables -------#
>> print(f" a := {eqq[0]}")
a := u9*(-x1*y2 + x1*y3 + x2*y1 - x2*y3 - x3*y1 + x3*y2)
>> print(f" b := {eqq[1]}")
b := u9*(u0*y1 - u0*y2 + u2*y2 - u2*y3 - u4*y1 + u4*y3)
>>> print(f" c := {eqq[2]}")
c := u9*(u1*y2 + u3*y3 + u5*y1 - u6*y3 - u7*y2 - u8*y1)
2.3 Circle Equation ΒΆ
The equation of circle with center at point \(\mathbf{r}_o = (x_o, y_o)\) and radius \(\rho\) can be stated in vector form as as
in algebraic form this equation is
Hence,
or in less concise form
Where,
- \(E = -2 x_o\)
- \(F = -2 y_o\)
- \(F = x_o^2 + y_o^2 - \rho^2\)
Finding the circle that passes through three points
Given the points \(\mathbf{r}_1 = (x_1, y_1)\), \(\mathbf{r}_2 = (x_2, y_2)\), and \(\mathbf{r}_3 = (x_3, y_3)\), it is possible to find the equation of the circle that passes through those points in the form \(x^2 + y^2 + Dx + Ey + F = 0\) by solving the following system of equations for the parameters \(D\), \(E\) and \(F\).
or in terse form
where
- \(\mathbf{x} = (x_1, x_2, x_3)\) (column vector)
- \(\mathbf{y} = (y_1, y_2, y_3)\) (column vector)
- \(\mathbf{x}.^2 = (x_1^2, x_2^2, x_3^2)\) - element-wise square of vector elements instead of square of matrix. NOTE: That many technical and scientific programming languages, including, APL, R (Rlang), Matlab and Fortran and Python/numpy uses functions that are applied to all elements of a matrix or vector. For instance, in Matlab or Python's Numpy, if v is vector v = [v1, v2, ..., v3], the function sin(v) will return [ sin(v1), ..., sin(v3)]. Although this type vectorized operations are common, there is no standard mathematical notation for denoting them.
The position of circle center \(\mathbf{r}_o = (x_o, y_o)\) and the radius \(\rho\) can be found as
Example (qd-edu-hk)
Find the equation of the circle passing through the pointsP(2,1), Q(0,5), R(-1,2).
Solution in Python's numpy
Import numpy
import numpy as np
import linalg as nl
Define the input data.
x = np.array([2, 0, -1])
y = np.array([1, 5, 2])
Create coefficients array of the linear system.
A = np.c_[x, y, np.ones(3)]
>> A
array([[ 2., 1., 1.],
[ 0., 5., 1.],
[-1., 2., 1.]])
Define vector of constants. NOTE: the method call .reshape(-1, 1) is used for ensure that \(\mathbf{b}\) is a column vector with shape (2, 1).
b = -(x**2 + y**2).reshape(-1, 1)
>> b
array([[ -5],
[-25],
[ -5]])
Solve the system of equations \(A \mathbf{x} = \mathbf{b}\).
coeffs = nl.solve(A, b)
>> coeffs
array([[-2.],
[-6.],
[ 5.]])
Find the parameters, \(D\), \(E\) and \(F\).
D, E, F = coeffs
>> D, E, F
(np.float64(-2.0), np.float64(-6.0), np.float64(5.0))
Determine \(x_o\), \(y_o\), the position of the circle center and its radius \(\rho\).
xo = -1/2 * D
yo = -1/2 * E
rho_square = xo**2 + yo**2 - F
>> np.array([xo, yo, rho_square])
array([1., 3., 5.])
Circle radius \(\rho\).
rho = np.sqrt(rho_square)
>> rho
np.float64(2.23606797749979)
So, for this set of points
- \(D = -2\)
- \(E = -6\)
- \(F = 5\)
- \(x_o = 1\)
- \(y_o = 3\)
- \(\rho^2 = 5\)
- \(\rho = \sqrt{5}\)
This result can be confirmed by defining the function
f = lambda x, y: (x - xo)**2 + (y - yo)**2 - rho_square
and applying it to \(\mathbf{x}\) and \(\mathbf{y}\).
>> f(x, y)
array([0., 0., 0.])
Hence, the equation of the circle passing through the given three points is
or
Solution 2 in Python's Numpy.
Import numpy
import numpy as np
import numpy.linalg as nl
Define helper function.
def find_circle_params(r1, r2, r3):
x1, y1 = r1
x2, y2 = r2
x3, y3 = r3
x = np.array([x1, x2, x3])
y = np.array([y1, y2, y3])
A = np.c_[x, y, np.ones(3)]
b = -(x**2 + y**2)
coeffs = nl.solve(A, b)
D = float(coeffs[0])
E = float(coeffs[1])
F = float(coeffs[2])
xo = -D/2
yo = -E/2
radius = np.sqrt(xo**2 + yo**2 - F)
radius = float(radius)
return xo, yo, radius
Input parameters
r1 = (2, 1)
r2 = (0, 5)
r3 = (-1, 2)
Find the circle that fits the points.
xo, yo, radius = find_circle_params(r1, r2, r3)
xo, yo, radius**2
(1.0, 3.0, 5.000000000000001)
3 Trigonometric Functions and Identities ΒΆ
3.1 Trigonometric Functions ΒΆ
Basic Trigonometric Identities
Euler's Identity
Note: \(j = \sqrt{-1}\) imaginary unit and \(\theta\) is the angle in radians.
Half Angle Trigonometric Identities
Double Angle Formulas Trigonometric Identities
Properties
Properties | |
---|---|
Symmetry Properties | |
Cosine is an even function (pt: funΓ§Γ£o par) | \(\cos (-x) = \cos (x)\) |
Sine is a odd function (pt: funΓ§Γ£o impar) | \(\sin (-x) = - \sin(x)\) |
\(\sin (\pi/2 - x) = \sin(90 - x) = \cos x\) | |
\(\cos (\pi/2 - x) = \cos(90 - x) = \sin x\) | |
\(\cos (\pi/2 - x) = \cos(90 - x) = \sin x\) | |
Arc Operations | |
Sin of the sum of angles | \(\sin(x + y) = \sin x . \cos y + \cos x . \sin y\) |
Cos of the sum of angles | \(\cos(x + y) = \cos x . \cos y - \sin x . \sin y\) |
Identities | |
Pythagorean identity | \((\sin x)^2 + (\cos x)^2 = 1\) |
Notable angles
Degrees | Randians | Sin | Cos | Tan |
---|---|---|---|---|
0 | 0 | 0 | 1 | 0 |
30 | \(\pi/6\) | 1/2 | \(\sqrt{3}/2\) | \(\sqrt{3}/3\) |
45 | \(\pi/4\) | \(\sqrt{2}/2\) | \(\sqrt{2}/2\) | 1 |
60 | \(\pi/3\) | \(\sqrt{3}/2\) | 1/2 | \(\sqrt{3}\) |
90 | \(\pi/2\) | 1 | 0 | \(\infty\) |
180 | \(\pi\) | 0 | -1 | 0 |
270 | \((3/2) \pi\) | -1 | 0 | \(-\infty\) |
360 | \(2\pi\) | 0 | 1 | 0 |
3.2 Trigonometric Identities ΒΆ
Sine and Cosine Relation
Euler's Equation and Complex Numbers
Let \(\mathrm{j} = \sqrt{-1}\) be the imaginary unit.
Complex Exponential
and,
Cosine of angle in radians expressed as linear combination of complex exponential
Sine of angle in radians expressed as linear combination of complex exponential
Derivative of complex exponential with respect to angle in radians.
Functions Symmetry
Trigonometric expansions
4 Derivatives ΒΆ
4.1 Derivative Rules ΒΆ
Function | Derivative | Description |
---|---|---|
f(x) | \(\dot{f}(x) = \dfrac{df}{dx}\) | Derivative of generic function |
\(r(x) = c\) | 0 | Derivative of constant |
\(c f(x)\) | \(c \dfrac{df}{dx}\) | Function multiplied by constant |
\(c + f(x)\) | \(\dfrac{df}{dx}\) | Function added to constant |
\(f(x) + g(x)\) | \(\dfrac{df}{dx} + \dfrac{dg}{dx}\) | Sum of functions |
\(f(x) g(x)\) | \(f \dfrac{f}{dx} + g \dfrac{df}{dx}\) | Product of functions |
\(f(u(x))\) | \(\left[\dfrac{d}{du} f(u) \right] \dfrac{du}{dx} = \dfrac{df}{du} \dfrac{du}{dx}\) | Chain Rule |
\(\dfrac{1}{f(x)}\) | \(-\dfrac{1}{f^2} \dfrac{df}{dx}\) | Dertivative of function |
\(\dfrac{g}{f}\) | \(\dfrac{f \dot{g} - g \dot{f}}{f^2}\) | Derivative of ratio |
\(f^{-1}(x)\) | \(\left. \left[ \dfrac{d}{dy} f(y) \right]^{-1} \right\vert_{y = f^{-1}(x)}\) | Derivative of inverse function |
\(\left. \dfrac{d}{dx} f^{-1}(x) \right\vert_{x = a}\) | \(\left. \left[ \dfrac{d}{dy} f(y) \right]^{-1} \right\vert_{y = f^{-1}(a)}\) | Derivative of inverse function evaluated at x = a |
4.2 Basic Derivatives ΒΆ
Function f(x) | Derivative | |
---|---|---|
\(x\) | 1 | |
\(x^2\) | \(2x\) | |
\(x^3\) | \(3 x^2\) | |
\(x^p\) | \(p x^{p - 1}\) | \(p \in \mathbb{R}\) |
\(1/x\) | \(-1/x^2\) | |
\(\sqrt{x}\) | \(\dfrac{1}{2 \sqrt{x}}\) | |
\(e^x\) | \(e^x\) | |
\(e^{a x}\) | \(a e^{a x}\) | |
\(a^x\) | \(a^x \ln a\) | |
\(e^{f(x)}\) | \(e^{f(x)} f(x) \dot{f}(x)\) | |
\(\ln x\) | \(1/x\) | Derivative of natural logarithm base \(\mathrm{e}\) |
\(\log_a x\) | \(\dfrac{1}{x \ln a}\) | Derivative of logarithm of base a |
\(\sin x\) | \(\cos x\) | |
\(\cos x\) | \(- \sin x\) | |
\(\tan x\) | \(\sec^2 x\) | |
\(\sec x\) | \(\sec x \tan x\) | |
\(\sin^{-1}(x)\) | \(\dfrac{1}{\sqrt{1 - x^2}}\) | arc sine |
\(\cos^{-1}(x)\) | \(-\dfrac{1}{\sqrt{1 - x^2}}\) | arc cosine |
\(\tan^{-1}(x)\) | \(\dfrac{1}{1 + x^2}\) | arc tangent or arctan |
4.3 Derivative of Inverse Function ΒΆ
Derivative of inverse function \(f^{-1}(x)\) of \(f(x)\) at \(x = a\).
Procedure for Determining the derivative of the inverse
STEP 1: Given a, solve the following equation for y, in order to find \(y_a\), the solution of this equation.
STEP 2: Compute the derivative of \(f(y)\) with respect to y at \(y = y_a\).
STEP 3: Compute the value of the derivative of the inverse function of f(x) by taking the inverse of the previous result w.
Examples
4.4 Chain Rule ΒΆ
Chain rule for function of one variable
This notation explicitly states that the in the right-hand side of the equation f is expressed as function of u and not as function of x.
Concise notation for chain rule for functions of a single variable
Chain rule for function of multi-variable functions
Chain rule for coordinate changing
Let f be function of \(x\) and \(y\). A new coordinate is introduced withcoordinates \(v\) and \(w\) in a way that \(x = x(v, w)\) and \(y = y(v, w)\). The partial derivative of f with respect to the new coordinate \(v\), \(w\) can be determined as:
Examples
4.5 Tangent Line Equation ΒΆ
The derivative can be used for obtaining the tangent line equation \(\eqref{eqtanget_diff}\) to a curve represented by a function f(x) at a particular point, where \(\alpha \in \mathbb{R}\) and \(\beta \in \mathbb{R}\) are the coefficients of the line equation.
The coefficient \(\alpha\), the line slope, can be computed as:
Then, the coefficient \(\beta\) can be found by replacing the pair $x_a, : \(y_a = f(x_a)\) in \(\eqref{eqtanget_diff}\) and solving it for \(\beta\).
so,
The, the coefficients of the line equation tangent to the point \((x_a, y_a)\) are given by:
5 Integrals ΒΆ
References:
General Rules
Linear combination of integrals:
Power of a function:
Ratio between function's derivate and itself:
Common Integrals
Constant:
Power:
Power:
Exponential:
Logarithm:
Sine:
Cosine:
Square sine:
Square cosine:
Sinh - hyperbolic sine:
Cosh - hyperbolic consine:
6 Sums of Series ΒΆ
- Reference: Dan Stefanica, A Primer for Mathematics of FinancialEngineering, 1st ed. New York: FE PRess, 2008. Page 4.
7 Taylor Series ΒΆ
7.1 Taylor series expansion ΒΆ
The Taylor series is a expansion of a real function f(x) about a point x a. When a is equal to 0, the expansion is also known as Maclaurin series.
The Taylor series expansion is sometimes written as:
where:
- \(f^{(n)}(x) = \dfrac{d^nf}{dx^n}\) is the derivative of order n of a function f(x)
- \(f^{(0)}(x) = f(x)\) - "derivative" of order zero, it is the same as f(x).
- \(f^{(1)}(x) = \dfrac{df}{dx}\) - first order derivative
- \(f^{(2)}(x) = \dfrac{d^2f}{dx^2}\) - second order derivative
7.2 Some Taylor series expansion ΒΆ
Exponential
Consine
Sine
Inverse tan or arctan
Natural Logarithm
Geometric Power Series
7.3 Approximations for small values of x ΒΆ
Misc Approximation
Approximations for small angles
- Where \(\theta\) is the angle in radians.
7.4 References ΒΆ
- Wolfram MathWorld
- Wikipedia - Taylor Series
- Wikipedia - Small Angle Approximations
- Expansions for Small Quantities
8 Multivariate Calculus ΒΆ
8.1 Gradient Vector ΒΆ
Consider a scalar-valued function \(f\) of two variables \(f = f(x, y) \in \mathbb{R}\), the gradient of this function is the vector
Where \(\hat{\mathbf{x}}\) is the unit vector of \(x\) axis, \(\hat{\mathbf{y}}\) is the unit vector of the \(y\) axis and \(\nabla\) is the operator
or in matrix form,
In some text books, the \(x\) axis unit vector is referred as \(i\) or \(\mathbf{i}\) and the \(y\) axis unit vector is referred as \(j\) or \(\mathbf{j}\). Those notations are avoided due to the possible confusion since \(i\) is sometimes used to referrer to either electrical current or the imaginary unit \(i = \sqrt{-1}\) and the letter \(j\) is also used in electrical engineering for denoting the imaginary unit \(j = \sqrt{-1}\).
8.2 Directional Derivative ΒΆ
The directional derivative $ D_{\mathbf{u}} f$ in the direction \(\mathbf{u}\) of a function \(z = f(x, y)\) of two variables, which represents a surface in space, is given by
or
Where \(\mathbf{u} = (u_x, u_y)\) and \(\theta\) is the angle betwen \(\mathbf{u}\) and the gradient vector \(\nabla f\). The directional derivative has the highest positive value when \(\theta = 0\) in the direction of the gradient vector. The direction of the highest decrease of the directional derivative is in the opposite direction of the gradient vector when \(\theta = \pi\) (180 degrees).
8.3 Change of Variables and Jacobian Matrix in a Plane ΒΆ
Let \((x, y)\) be the cartesian coordinates of a plance, a 2-dimensional space, where \(x = x(u, v)\) and \(y = y(u, v)\).
The jacobian matrix of this variable transformation is defined as
Where
- \(\mathbf{r} = (x, y)\) is the position vector, which is a 2 by 1 column matrix (column vector);
- \(\nabla_{(u, v)}^T x\) is the transpose of the gradient of the scalar \(x\) with respect to the vector \((u, v)\).
- \(\nabla_{(u, v)}^T y\) is the trnaspose of the graident of the scalar \(y\) with respec to the vector \((u, v)\).
Area Double Integral
The area in double integral is given by
Area Differential
The area differential is given by
where \(| \det J |\) is absolute value of the determinant of the jacobian matrix.
Area in Polar Coordinates
Planar cartesian coordinates \((x, y)\) can be turned into polar coordinates as \((\theta, r)\), where
- \(x = x(\theta, r) = r \cos \theta\)
- \(y = y(\theta, r) = r \sin \theta\)
Compute the partial derivative of \(\mathbf{r} = (x, y)\) vector with respec to \(\theta\).
Compute the partial derivative of \(\mathbf{r} = (x, y)\) vector with respec to \(\theta\).
Determine the jacobian matrix
Compute the determinant of the jacobian matrix.
The area differential in polar coordinates is given by
Therefore, the area of a region in polar coordinates is
8.4 Change of Variables and Jacobian Matrix in a Space ΒΆ
8.5 Derivative Chain Rule ΒΆ
8.6 See also ΒΆ
- Change of variables and Jacobians
- The Jacobian for Polar and Spherical Coordinates, Department of Mathematics, Oregon State University (1996)
- 3.8: Jacobians, Larry Green, Lake Tajoe Community College
9 Statistical Formulas ΒΆ
Source:
Notation:
- \(\pmb{X}\) bold capital letters mean probability distribution.
- Var(X) => Variance of the distribution X
- Cov(X, Y) => Covariance of the proabilities distributions X and Y
- \(\sigma_x\) => Standard deviation of variable X
- \(\mu\) => Average or menan of random variable X
Expected Value Identities
Expected value of constant 'a':
Expected value of a linear combination of random variables, 'a' and 'b' are constants.
Covariance, Variance, Standard Deviation Identities
10 Linear algebra ΒΆ
10.1 Notation ΒΆ
General:
-
\(I = I_n\) (n x n)
- identity matrix with all diagonal elements set to 1.
-
\(1_{n, m}\) (n x m)
- Matrix with n rows and m columsn with all elements set to 1.
-
\(A_{(n x m )}\) or A (n x m)
- A is a matirx with n rows and m columns
- \(A^T\) (m x n) - Transpose matrix of A
-
\(A^{-1}\) inverse matrix of A for which:
- \(A A^{-1} = A^{-1} = A I\)
Column vector:
- Vcol (n x 1) matrix of a single column containing n elements.
Row vector:
- (1 x n) matrix of a single row.
10.2 Special matrices ΒΆ
Zero matrix:
julia> zeros(3, 3)
3Γ3 Array{Float64,2}:
0.000 0.000 0.000
0.000 0.000 0.000
0.000 0.000 0.000
julia> zeros(3, 1)
3Γ1 Array{Float64,2}:
0.000
0.000
0.000
Identity Matrix:
- All diagonal elements are 1.
using LinearAlgebra
julia> eye(n) = zeros(n, n) + I
julia> eye(3)
3Γ3 Array{Float64,2}:
1.000 0.000 0.000
0.000 1.000 0.000
0.000 0.000 1.000
julia> eye(4)
4Γ4 Array{Float64,2}:
1.000 0.000 0.000 0.000
0.000 1.000 0.000 0.000
0.000 0.000 1.000 0.000
0.000 0.000 0.000 1.000
Ones-based matrices:
\(1_{n, n} = 1 \quad \text{for every i, j}\)
julia> ones(2, 2)
2Γ2 Array{Float64,2}:
1.00000E+00 1.00000E+00
1.00000E+00 1.00000E+00
julia> ones(3, 2)
3Γ2 Array{Float64,2}:
1.00000E+00 1.00000E+00
1.00000E+00 1.00000E+00
1.00000E+00 1.00000E+00
julia> ones(3, 1)
3Γ1 Array{Float64,2}:
1.00000E+00
1.00000E+00
1.00000E+00
11 Types of matrices ΒΆ
Symmetric Matrix
Any matrix which equals to its transpose:
Aij = Aji
# -------- Symmetric matrix ---------
julia> A = [1 7 3; 7 4 -5; 3 -5 6]
3Γ3 Array{Int64,2}:
1 7 3
7 4 -5
3 -5 6
julia> A'
3Γ3 LinearAlgebra.Adjoint{Int64,Array{Int64,2}}:
1 7 3
7 4 -5
3 -5 6
julia> A' A
true
Non Symmetric Matrix:
julia> B = [3 8 7; 9 5 6; 1 2 3]
3Γ3 Array{Int64,2}:
3 8 7
9 5 6
1 2 3
julia> B'
3Γ3 LinearAlgebra.Adjoint{Int64,Array{Int64,2}}:
3 9 1
8 5 2
7 6 3
julia> B B'
false
11.1 Matrix Operations Rules ΒΆ
Matrix multiplication is not symmetric
julia> A = [ 4 5; 6 7]
2Γ2 Array{Int64,2}:
4 5
6 7
julia> B = [ 8 2; 1 5]
2Γ2 Array{Int64,2}:
8 2
1 5
julia> A * B
2Γ2 Array{Int64,2}:
37 33
55 47
julia> B * A
2Γ2 Array{Int64,2}:
44 54
34 40
julia> A * B B * A
false
Associativity
Transpose matrix
Tranpose of product:
Transpose of sum:
11.2 Column vector properties ΒΆ
Let a and b be two (n x 1) column vectors:
The scalar product (dot product) between a and b is:
The L-2 norm or euclidian norm of a vector is given by:
12 Matrix Calculus ΒΆ
12.1 Definitions ΒΆ
Let x be a (n x 1) column vector and y be a (m x 1) column vector.
12.2 Derivate of a scalar with respect to a vector ΒΆ
If \(F(X): R^N \rightarrow R\) - F(X) = F(x1, x2, ... xn) is a multivariate function, the derivate of the scalar function F(X) with respect to the vector X is:
- Note: \(\nabla F\) means gradient vector of F(X)
See:
-
http://www.ams.sunysb.edu/~zhu/ams571/matrixvector.pdf
- Page 38, page 39
12.3 Derivate of a vector with respect to a scalar ΒΆ
If the vector Y is a function (Y = Y(t)) of the scalar t, the derivate of Y with respect to t is:
12.4 Derivate of a vector with respect to a vector ΒΆ
If the vector Y (m x 1) is a function of the vector X (n x 1), then the derivate of Y with respect to Y is:
- where J[Y(X)] is the Jacobian matrix of Y(X)
12.5 Derivate rules for matrices and vectors ΒΆ
References:
- http://www.ams.sunysb.edu/~zhu/ams571/matrixvector.pdf
- https://atmos.washington.edu/~dennis/MatrixCalculus.pdf
- https://www.comp.nus.edu.sg/~cs5240/lecture/matrix-differentiation.pdf
- http://www.ee.ic.ac.uk/hp/staff/dmb/matrix/calculus.html
- https://en.wikipedia.org/wiki/Matrix_calculus
Let X be n x 1 vector where \(x \in R^n\)
Let C be matrix of (n x n) constant elements where \(C \in R^{n x n}\)
The following identities are valid:
- Derivate of product between constant matrix and column vector.
- Derivate of product between column vector and constant matrix.
-
Derivate of scalar product between vector and itself.
- Note: this result is a vector.
-
Derivate of a scalar product between vectors.
- Let Y be a (n x 1) vector.
- Derivative of quadratic form.
-
Derivative of scalar defined by \(\alpha = y^T . A . x\)
- A is a (m x n) matrix independent of both X and Y.
- Y is (m x 1) vector independent of X.
- X is a (n x 1) vector.
-
Chain rule of the derivate of scalar product.
- Note: \(\alpha\) is a scalar.
- Note: v is a vector and dependent on vector x.
12.6 Useful gradients ΒΆ
Reference: Imperial College of London and (Petersen and Pederson, 2012)
List of useful and pervasive identities for computing gradient in machine learning.
Where,
- \(\det A\) is the determinant (scalar) of a square matrix A.
- \(\mathrm{tr}(A)\) is the trace of matrix A, sum of diagonal elements.