Math: Probability
Probability calculates the likelihood of an Outcome occuring A Priori.
Probability Space
A Probability Space is defined as the Triple (Ω, E, P):
- A Probability Function:
Pmapped to the interval[0,1]P : E → [0,1]
- A Set of Outcomes
Ω.- Say, a 6-sided dice is being represented:
Ω = {1,2,3,4,5,6}
- Say, a 6-sided dice is being represented:
- An Event Space
Eof all Events such that for every∀(e ∈ E)(e ⊆ Ω).- E.g. -
e₀ ∈ Eande₀ = {2, 5}(Complex Event where it lands on any of2,5.) - E.g. -
e₁ ∈ Eande₁ = {1}(Lands on1.)
- E.g. -
Events
- Indepdendent
- Two events
A,Bare are Indepdendent if the liklihood ofAdoesn't influence the liklihood ofBoccurring.
- Two events
- Dependent
- Two events
A,Bare are Dependent if the liklihood ofAoccurring influences the liklihood ofBoccurring.
- Two events
- Mutually Exclusive
- Two events
A,Bare are Mutually Exclusive if they can never occur simultaneously. - Two events
A,Bare are Mutually Exclusive ifAobtaining entails thatBcannot also obtain.
- Two events
Probability Rules
Definitions:
P(A) = 1:Ais Certain to occur.- Certainty
P(A) = 0:ACertainly Won't occur.- Impossibility
P(A ∪ B)- The likelihood of either
AorBoccuring.
- The likelihood of either
P(A ∩ B)- The likelihood of both
AandBoccuring.
- The likelihood of both
P(A′)- Complement of
A. - The Outcome(s) where
Adoesn't occur.
- Complement of
P(A|B)- The likelihood of
AgivenB.
- The likelihood of
General Rules:
- Addition Rule:
- (When
A,Bare Independent Events:)P(A ∪ B) = P(A) + P(B) - P(A ∩ B)
- (When
- Multiplication Rule:
- (When
A,Bare Independent Events:)P(A ∩ B) = P(A) × P(B)
- (When
- Complement Rule:
P(A′) = 1 - P(A)- The likelihood of
A′occuring is1minusA.
- Conditional Probability:
P(A|B) = P(A ∩ B) / P(B)- Bayes' Theorem
- Note that:
P(A|B) ≠ P(B|A)(not Symmetric).
| Description | General Form | A,B Independent | A,B Dependent | A,B Mutually Exclusive |
|---|---|---|---|---|
| Both, Conjunction |
P(A ∩ B) = P(A) × P(B)
|
P(A ∩ B) = P(A) × P(B|A)
|
P(A ∩ B) = 0
|
|
| XOR, OR |
P(A ∪ B) = P(A) + P(B) - P(A ∩ B)
|
P(A ∪ B) = P(A) + P(B) - P(A) × P(B)
|
P(A ∪ B) = P(A) + P(B) - P(A) × P(B|A)
|
P(A ∪ B) = P(A) + P(B) - 0
P(A ∪ B) = P(A) + P(B)
|
| Conditional, Dependent |
P(A|B) = P(A ∩ B) / P(B)
|
P(A|B) = (P(A) × P(B)) / P(B)
|
P(A|B) = (P(A) × P(B|A)) / P(B)
|
P(A|B) = 0 / P(B)
|
https://www.nasa.gov/wp-content/uploads/2023/11/210624-probability-formulas.pdf
Resources and Links
Math: Permutations
Definitions
- Permutations:
ₙPₐ = n! / (n - a)!- The number of Permutations of
nitems takena-many at a time. - Consider Heap's Algorithm.
- Given (the digit String)
012the generated Permutations are[ '012', '102', '201', '021', '120', '210' ]
- Given (the digit String)
- An arrangement of elements (with or without repetition) where order matters.
- Order matters:
012 ≠ 102. - Counts String Permutations like
0012,1102, etc. when repetition is allowed.
- Order matters:
- The number of Permutations of
- Combinations:
ₙCₐ = n! / (a! × (n - a)!)- The number of Combinations of
nitems takena-many at a time. - An arrangement of elements (with or without repetition) where order doesn't matter.
- Order doesn't matter:
012 = 102.012,102are elements of the same Equivalence Class using the generated Strings (from above).- Are considered the same String Combination despite the ordering of the digits
0,1,2.
- Counts String Combinations like
0012,1102, etc. when repetition is allowed.
- Order doesn't matter:
- The number of Combinations of
- Variations
- Where order matters:
ₙVₐ = ₙPₐ - Where order doesn't matter:
ₙVₐ = nᵃ - The number of Variations of
nitems takena-many at a time. - An arrangement of elements (with or without repetition) where order matters.
- Order matters:
012 ≠ 102. - Counts String Variations like
0012,1102, etc. when repetition is allowed.
- Order matters:
- Where order matters:
Relationships
- Since
ₙCₐ = n! / (a! × (n - a)!), it follows thatₙCₐ = ₙPₐ / a!(from substitution). - Also,
ₙPₐ = ₙCₐ × a!(from the above). - Where order matters:
ₙVₐ = ₙPₐ(Variation and Permutation count can be computed in the same manner).
Resources and Links
Math: Geometry
Trigonometric Ratios
Used to determine certain properties of a Right Triange.
Where φ is the Angle, O the Opposite Length, A the Adjacent Length, and H the Hypotenuse:
- Sine:
sin(φ) = O ÷ H - Cosine:
cos(φ) = A ÷ H - Tangent
tan(φ) = O ÷ A
A helpful mnemonic device I was taught in High School: SOH, CAH, TOA.
- Cosecant:
csc(φ) = H ÷ O- The Inverse of Sine:
csc(φ) = 1 ÷ sin(φ) sin(φ) = cos(90° - φ)
- Secant:
sec(φ) = H ÷ A- The Inverse of Cosine:
sec(φ) = 1 ÷ cos(φ)
- Cotangent:
cot(φ) = A ÷ O- The Inverse of Tangent:
cot(φ) = 1 ÷ tan(φ)
Radians Conversion
Where r expresses the number of Radians and d the number of Degrees:
- Degrees to Radians:
r = d × (π ÷ 180) - Radians to Degrees:
d = r / (π ÷ 180)d = (r × 180) ÷ π
90° = π ÷ 2 Radians
Acute Angles
- Any two Acute Angles of Right Triangle will add up to
90°
Math: Statistics
Statistics calculates the likelihood of an Outcome occuring by observed Frequency, trend, or pattern.
Median, Mean, Mode
Given a sum S of L-many values of some (sorted) Set of events E:
- Median
- If
Lis even, take the middle two events and divide by2. - If
Lis odd, take the middle event and divide by1.
- If
- Mode
- Most common or frequently encountered value in the Set.
- Mean
= S / L
Standard Normal Distribution
πe- Euler's Constant
e = 2.71828...- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/E
https://www.cse.wustl.edu/~garnett/cse515t/fall_2019/files/lecture_notes/5.pdf
const VARIANCE_U = 1
const MEAN_O_2 = 1
const X = 1
const NORMALIZATION_CONSTANT = 1 / Math.sqrt(VARIANCE_U * 2 * Math.PI)
const EXP = -1 * Math.pow(X - VARIANCE_U, 2) / (2 * Math.pow(MEAN_O_2, 2))
const GUASS = 1 / NORMALIZATION_CONSTANT * Math.pow(Math.E, EXP)
The Math 142 course I took delimits course content to the subtopics subheaded below. (We didn't cover calculating Z Scores from scratch.)
- Computation of the Distribution itself is given by this table.
Standard Deviation
Of a Normal Distribution.
Given a set of values {X₀, ..., Xₙ}:
- Calculate the Mean (
μ):- In Normal Distribution, the Mean, Mode, and Median are the same.
μ = (X₀ + ... + Xₙ)/n
- Calculate the Standard Deviation (
σ) like so:σ = √(((X₀-μ)² + ... + (Xₙ-μ)²) / n - 1)- Note that both the numerator and denominator are squared!
- It's also helpful to remember the following:
μ ± σ(the range-σ <= μ <= σor one Standard Deviation) covers68%μ ± 2σ(the range-2σ <= μ <= 2σor two Standard Deviations) covers95%μ ± 3σ(the range-3σ <= μ <= 3σor three Standard Deviations) covers99.7%
Calculate Z Score
General approach:
- Calculate
Z(the number of Standard Deviations) independently.- This can be calculated from a specified Percentage (say
10%of the total Area) - Or from a Score using the same equation:
Z = (x - μ) / σwherex(lowercase) is the specified Score.
- This can be calculated from a specified Percentage (say
- Then use that value to solve for some
X(some Score within the Standard Deviation)Z = (X - μ) / σorZ * σ + μ = X.- Example: find the Score (
X) for the top10%of some Normal Distribution with Mean140(μ = 140) and a Standard Deviation of19(σ = 19). Z.₁₀ * σ + μ = XorZ.₁₀ * 19 + 140 = X.
- Example: find the Score (
Calculating Interquartile Ranges
Given the sorted sequence 51, 52, 54, 55, 63, 70, 90, 100:
- Minimum:
51 - Lower Quartile:
52- find the Median from index0to the Absolute Median (inclusive, exclusive) - Mean:
(51, 52, 54, 55, 63, 70, 90, 100) / 8 = 66.875 - Median:
(55 + 63) / 2 = 59 - Upper Quartile:
90- find the Median from the Absolute Median to the end (exclusive, inclusive) - Maximum:
100 - Interquartile Range:
90 - 52 = 38
Resources and Links
- https://www.geeksforgeeks.org/statistics/?ref=shm
- https://www.geeksforgeeks.org/standard-normal-distribution/#normal-distribution-definition
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/PI
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/E
- https://www.cse.wustl.edu/~garnett/cse515t/fall_2019/files/lecture_notes/5.pdf
- https://mathblog.com/statistics/definitions/z-score/percentile-to-z-table/
Code samples:
Math: Finance Topics
Math and Finance topics often encountered in Programming/Software Engineering.
Quick Reference
| Loan Type | Payment Type | Description | Calulated Value | Equation | Variables |
|---|---|---|---|---|---|
| Amortized | Monthly Fixed | Monthly Payment (Interest and Principal) | (First or) Monthly Payment Amount | M = (P * (r / 12)) / (1 - (1 + r / 12) ^ (-12 * y)) |
r (Annualized Interest Rate), y (number of years), P (Principal) |
| Amortized | Monthly Fixed | Monthly Interest Payment | Monthly Interest Amount | N = P * r / 12 |
r (Annualized Interest Rate), P (Starting or Current Principal) |
| Amortized or Compounded | Monthly Fixed or Monthly | Future Value | (First or) Monthly Payment Amount | A = (M * ((1 + r / 12) ^ (12 * y) - 1)) / (r / 12) |
r (Annualized Interest Rate), y (number of years), M (Monthly Payment Amount) |
| Compounding | Monthly | Loan Total (All Interest and Principal) | Loan Total | T = P * (1 + r) ^ y |
r (Annualized Interest Rate), y (number of years), P (Principal) |
| Compounding | Continuous | Loan Total (All Interest and Principal) | Loan Total | T = P * e ^ (ry) |
r (Annualized Interest Rate), y (number of years), P (Principal), e (Euler's Constant) |
| Any | Monthly Fixed | Loan Total (All Interest and Principal) | Loan Total | T = M * (y * 12) |
y (number of years), M (Monthly Payment Amount) |
| Any | Monthly Fixed | Monthly Payment From Loan Total (All Interest and Principal) | Monthly Payment Amount | M = T / (y * 12) |
y (number of years), T (Loan Total) |
| Any | Any | Total Interest Paid From Loan Total and Principal | Interest Total | I = T - P |
P (Principal), T (Loan Total) |
Amortization and Interest
- Non-Amortizing Loans are computed in a number of ways.
- One way involves Basic Compound Interest divided by Total Months:
(P * (1 + r) ^ (12 * t)) / (t * 12) - For example, if Monthly Payment Amounts (
M) are known the (Compounded) Future Value can be computed:A = (M * ((1 + r / n) ^ (n * t) - 1)) / (r / n)whereris the Interest Rate (Annual),nthe number of months, andtthe number of years.- Note: This equation can be used to compute Future Amortized Values and many other Annuities!
- One way involves Basic Compound Interest divided by Total Months:
- Amortization is a standard technique to calculate Monthly or Total Payments (over time) as the Principle (of a Loan) is paid down:
- Computations vary for Monthly or Total Amortization Payments/Schedules/Table.
- There are also different kinds of Amortization (and each is computed a bit differently):
- Full amortization with a fixed rate (Straight-Line)
- Full amortization with a variable rate
- Full amortization with deferred interest
- Partial amortization with a balloon payment (Balloon)
- Negative amortization
- Bullet
- Declining Balance
- etc.
- Computed long-hand here
- Monthly Payments:
M = (P * (r / 12)) / (1 - (1 + r / 12) ^ (-12 * t))wherePis the Principal,ris the Interest Rate (Annual), andtthe number of years.
Principle and Interest Payments
As found when calculating most kinds of Mortgages:
$250,000with12%down$250,000 - ($250,000 * .12) = $250,000 - $30,000or$220,000the Mortgage Principal lent.- Suppose the Annual Interest Rate is
6%. - Total (first) Monthly Interest Payment is calculated:
$220,000 * (.06 / 12) = $1,100. - Given a Monthly Payment of say
$1,928then Mortgage Principal is reduced by:$1,928 - $1,100 = $828(the first month). - (The process then repeats for subsequent Monthly Payments.)
General method to calculate Simple Interest:
I = P * r * twherePis the Principal,ris the Interest Rate (Annual or Monthly), andtthe relevant duration of time.
Resources and Links
- https://corporatefinanceinstitute.com/resources/commercial-lending/non-amortizing-loan/
- https://www.investopedia.com/terms/a/amortization.asp
- https://www.accountria.com/blog/what-is-amortization-10-different-types-of-amortized-loans/
- https://www.public.asu.edu/~kamman/notes/finance/amortized-loan-notes.pdf
- https://www.investopedia.com/terms/f/future-value-annuity.asp
Math: Financial Programming
Amortization and Interest
Non-Amortizing Loans are computed in a number of ways.
One way involves Basic Compound Interest divided by Total Months:
const PRINCIPLE = 1000 const ANNUAL_INTEREST_RATE = .07 const YEARS = 5 const TOTAL_LOAN_PAYMENTS = PRINCIPLE * Math.pow(1 + ANNUAL_INTEREST_RATE, YEARS) console.log(TOTAL_LOAN_PAYMENTS) // 1402.5517307000005 const MONTHLY_PAYMENTS = TOTAL_LOAN_PAYMENTS / (YEARS * 12) console.log(MONTHLY_PAYMENTS) // 23.375862178333342
Amortization is a standard technique to calculate Monthly or Total Payments (over time) as the Principle (of a Loan) is paid down:
- A standard approach to calculate Monthly Payments:
const ANNUAL_INTEREST_RATE = .07 const PRINCIPLE = 1000 const MONTHLY_INTEREST_RATE = ANNUAL_INTEREST_RATE / 12 const NUMER = MONTHLY_INTEREST_RATE * Math.pow(1 + MONTHLY_INTEREST_RATE, 60) const DENOM = Math.pow(1 + MONTHLY_INTEREST_RATE, 60) - 1 const MONTHLY_PAYMENTS = PRINCIPLE * NUMER / DENOM console.log(MONTHLY_PAYMENTS) // 19.801198540349468
- A standard approach to calculate Monthly Payments:
Precision and Rounding
Rounding and Precision effects in JavaScript (and languages with equivalent inbuilt Math functions).
- Such effects are often encountered since quantities, amounts, etc. don't cleanly divide (and must therefore be Rounded or Truncated).
- Most currencies and denominations (globally) are represented with Decimal (Floating Point) Precision (e.g. -
$1.41).
https://www.public.asu.edu/~kamman/notes/finance/amortized-loan-notes.pdf helpfully described Amorization, Rounding, and Precision.
Verbiage
"To precision" generally means to the number of significant numbers or integers after the decimal point (the Character or sign .):
from decimal import *
getcontext().prec = 6
Decimal(1) / Decimal(7)
Decimal('0.142857')
To Cents
Additionally, it's common to represent "Dollar" amounts as "Cents" to avoid some of these issues.
Advantages:
- Don't have to worrry about post-decimal point sign Precision.
- Can help avoid unintentional duplicate Rounding Effects.
Disadvantages:
- Cents must still be Rounded.
Inbuilt Functions
Note that toPrecision() will unacceptably Truncate in some cases:
let num = 5.123456;
console.log(num.toPrecision()); // '5.123456'
console.log(num.toPrecision(5)); // '5.1235'
And, if the numbers are too big it'll return scientific notation. For example:
const N = 100000 / 24
console.log(N)
console.log(N.toPrecision(3)) // "4.17e+3"
console.log(N.toPrecision(6)) // "4166.67"
Mathematical Approaches and Techniques
JavaScript's Math.round(), Math.ceil(), and Math.floor() methods, combined with a multiplier, offer versatile solutions for computing to a specific Precision.
This is likely the most commonly encountered approach to Round to Precision 2 (from personal work experience in Finance and from widely available blogs like: https://www.zipy.ai/blog/how-to-round-to-at-most-two-decimal-places-in-javascript):
Round to nearest:
let number = 2.12556;
let rounded = Math.round(100 * number) / 100
console.log(rounded) // Output: 2.13
Always rounding up:
let number = 2.12556
let rounded = Math.ceil(number * 100) / 100
console.log(rounded) // Output: 2.13
Always rounding down:
let number = 2.12556
let rounded = Math.floor(number * 100) / 100
console.log(rounded) // Output: 2.12
Resources and Links
Code samples:
Math: Exponents
Review. Last time I took coursework about these was in highschool.
Quick Reference
Resources and Links
Math: Logarithms
Review. Last time I took coursework about these topics was in highschool.
Quick Reference
Graphing a Logarithmic Function
Given an equation of the form:
Find some easy Powers of a:
0th Power:
$$\displaystyle a^0 = 1$$$$\displaystyle g(1) = \log_a1 = 0$$Coordinate:
$$\displaystyle (1, 0)$$1st Power:
$$\displaystyle a^1 = a$$$$\displaystyle g(a) = \log_aa = 1$$Coordinate:
$$\displaystyle (a, 1)$$Generally
$$\displaystyle a^y = (x+m)$$$$\displaystyle g(x) = k + n\log_a(x+m) = k + ny$$Coordinate:
$$\displaystyle (x-m, k + ny)$$Think of the above as
x,ytransformations of the more basic:$$\displaystyle a^y = x$$$$\displaystyle g(x) = \log_ax = y$$Coordinate:
$$\displaystyle (x, y)$$
Resources and Links
Math: Functions
Review. Last time I took coursework about these was in highschool.
Quick Reference
W.R.T. Parabolic Graphs.
Inverse Function
Given:
To find the Inverse Function of f:
Replace
f(x)withy:$$\displaystyle y = 2x - 4$$Swap
yandx:$$\displaystyle x = 2y - 4$$Then solve for
y:$$\displaystyle \frac{x + 4}{2} = y$$$$\displaystyle y = \frac{x + 4}{2}$$Replace
ywith the Inverse Function off:$$\displaystyle f^{-1}(x) = \frac{x + 4}{2}$$
Inverse Functions satisfy the following conditions:
Domains
W.R.T. Composed and Combined Functions Graphs.
The Domains of Combined and Composed Functions are determined and restricted by f and g (the Outer and Inner Functions, respectively).
Suppose:
The intersection of the Domain of f and the Domain of g is (0, ∞) (exclusive, exclusive):
- Or,
x > 0. - The Domain of a Combined or Composite Function (of
f,g) is(0, ∞)orx > 0. - Neither the specific Operation nor the order of
forgmatters in these specific cases.
Combined Function Example
The Domains of Combined Functions:
will exclude:
0sincefdoes.- Any
n < 0sincegdoes. - So,
x > 0is the resultant Domain of the Combined Function.
Composed Function Example
Similarly for the Composed (Composite) Function:
the following are again excluded from the Domain:
0sincefdoes.- Any
n < 0sincegdoes. - So,
x > 0is the resultant Domain of the Composed Function.
Further Comments
Generally, the order of f and g do result in differing Combined or Composite Domains:
Note that the Domain of
f ◌ gis distinct from seeing the Domain off,gas "standalone" (like afunctionin JavaScript) and called successively.Suppose that the above functions
fwere defined instead like so:$$\displaystyle f(x) = \frac{1}{x - 4}$$Although
4is absent from the Domain of "standalone" Functionfit's not necessarily excluded fromf ◌ g.
- The above is a valid Rational Fraction afterall -
f ◌ gis in some sense treated as only takinggvalues (and is no longer seen as "standalone"). - However,
0remains excluded (asgis treated as a "standalone" Function in some sense prior tof ◌ g).
https://qcenter.hartford.uconn.edu/wp-content/uploads/sites/629/2022/02/Algebra-Workshops-WS-4.pdf
The easiest way to determine the Domain is as follows:
- Find the Domain of the Inner Function.
- Substitute
g(x)into eachxinf. - Multiply the Numerator and the Denominator by a constant (for example by:
√xin the example above) to remove the second Denominator like so:
- Take the Intersection of the result with the Domain of the Inner Function.
Parabolic Graphs
Transform Quadratic Functions into the form:
- This can then be used with Quadratic Formula (above).
- Or, to find the Vertex and other properties of the depicted Function (which forms a Parabola):
- If
a > 0, the depicted Parabola opens upwards and the Function will have a minimum. - If
a < 0, the depicted Parabola opens downwards and the Function will have a maximum. - If the full Vertex coordinate is known at
(h, k), the Functionf(x)will satisfy:
Range
To find the Range of a Parabola given a Function of the form:
- Transform the
finto:
- Complete the Square of
x² - 6x. Take half the coefficient ofxand Square it:(-6/2)². x² - 6x + 9which can be simplified into:(x - 3)².- The original equation must be modified by
-(a * 9)to keep the equality(5 * 9) - (5 * 9) = 0:$$\displaystyle f(x) = 5(x^{2} - 6x + 9) + 50 + -(5 \cdot 9)$$ $$\displaystyle f(x) = 5(x - 3)^{2} + 50 + -(5 \cdot 9)$$ $$\displaystyle f(x) = 5(x - 3)^{2} + 50 - 45$$
The result:
- since
a > 0, the Parabola opens upwards. - The Vertex
(h, k)is the minimum. - The Range is then
[k, ∞),[5, ∞).
System of Linear Factors
- Find the Zeros of the Function.
- If
f(n) = 0then(x-n)is a Factor of the Function (by the Factor Theorem).
Resources and Links
Math: Limits, Intercepts, and Asymptotes
Limits
- Right Limit
- Usually signified with a superscript
+ - Going/Moving from Right to the Limit.
- Usually signified with a superscript
- Left Limit
- Usually signified with a superscript
- - Going/Moving from Left to the Limit.
- Usually signified with a superscript
- Two-Sided Limit
fhas a Two-Sided Limit iff it has Right Limit, a Left Limit, and they are equivalent.
Intercepts
- X-Intercept of a Function:
- To find the X-Intercept, set
y = 0 - This is properly expressed as a Coordinate Pair.
- To find the X-Intercept, set
- Y-Intercept of a Function:
- To find the Y-Intercept, set
x = 0 - This is properly expressed as a Coordinate Pair.
- To find the Y-Intercept, set
Asymptotes
- A Line the Graph of a Function approaches (as a Limit) that it never touches, intersects, or crosses.
- Vertical Asymptote
- An Asymptote (Line) that crosses the X-Axis .
- A vertical Line approached but never crossed by the Graph of a Function.
- Example:
x = -4
- Horizontal Asymptote
- An Asymptote (Line) that crosses the Y-Axis.
- A horizontal Line approached but never crossed by the Graph of a Function.
- Example:
y = -4
Resources and Links
Math: Calculus - Limits
Rules of Thumb:
- Generally, directly substitute the Limit in and solve (if such a Limit exists).
- Determine the appropriate Laws to solve.
- Otherwise, one can inspect the graphed Function.
Continuity
Is a Local property. Holds of a Function f at a point x.
Continuity of f at a point x in its Domain fails if and only if, any one of the following holds:
The Left-Sided Limit Does Not Exist (
DNE) or is Infinite.$$\displaystyle \lim_{x \to a^-} f(x) = \pm \infty $$ $$\displaystyle \lim_{x \to a^-} f(x) = \text{DNE} $$The Right-Sided Limit Does Not Exist (
DNE) or is Infinite.$$\displaystyle \lim_{x \to a^+} f(x) = \pm \infty $$ $$\displaystyle \lim_{x \to a^+} f(x) = \text{DNE} $$Both the Left-Sided Limit and Right-Sided Limit exist and are Finite but:
- Don't equal each other.
- Either of the two don't equal
f(x).
Discontinuities
- Jumps:
- Typically encountered with Piecewise Functions.
- Point oscillation within a Function that leaves a Gap whilst still remaining defined.
- Holes:
- Where a value isn't in the Domain of
fand is Undefined,Does Not Exist.
- Gaps:
- Where a continuous Interval isn't Defined or produces nothing but Holes.
- An Interval such that every value in the Interval isn't in the Domain of
f.
Limits
We often begin with DNE or undefined values as interesting places to find Limits.
- That a Function
fis undefined atadoesn't imply it doesn't have a Limit. - Indeed,
amight be the Limit.
A (Two-Sided) Limit exists if and only if:
- It's Left-Sided Limit exists.
- It's Right-Sided Limit exists.
- And:
Importantly, when the Limit goes to
±∞and/or equals±∞we say it approaches a (Horizontal or Vertical) Asymptote of the Function.
Laws
Resources and Links
Math: Calculus - Derivatives
Rules of Thumb:
- Determine which notation is being used.
- Use the appropriate combination of rules and equivalences to eliminate
d/dxand Limits from the equation.
Derivatives
As the Instantaneous Rate of Change of a Function f at point c.
Forward is on the Interval
[c,c+h]computed from the Right. If the Right-Sided Limit exists:$$\displaystyle \lim_{h \to 0^+} \frac{f(c+h)-f(c)}{h}$$Backward is on the Interval
[c-h,c]computed from the Left. If the Limit exists:$$\displaystyle \lim_{h \to 0^-} \frac{f(c+h)-f(c)}{h} = \lim_{s \to 0^+} \frac{f(c)-f(c-s)}{s}$$Given a Function
f, defined on an Interval(a,b), its Instantaneous Rate of Change atcin(a,b)is the value of the Forward and Backward Instantaneous Rates of Change atcwhen they both exist and are the same.Given a Function
fdefined on an Interval(a,b)and acin(a,b)the Derivative offatc(f'(c)) is its Instantaneous Rate of Change atc:
To compute the Instantaneous Rate of Change it's sometimes necessary to divide a Function into a Piecewise Functions and evaluate each part of the Piecewise Function definition with its corresponding Left- or Right-Sided Limit.
It may also be useful to break a Function f into two non-Piecewise parts (to reduce the simplification of terms):
The following are therefore interchangeable ways to rewrite the Derivative:
g'andk'can be solved independently then recombined to solvef'.
Notation
Leibniz Notation
He had many and the exact meaning of this notation varies quite a bit.
Perhaps the most relevant disambiguation here is given by:
This treatment of
ymirrors the other approaches defined or described here.
Also:
Trigonometric Functions
Inverse Trigonometric Functions:
- arctan =
tan¯¹ - arcsin =
sin¯¹ - arccos =
cos¯¹ - arccot =
cot¯¹ - arcsec =
sec¯¹ - arccsc =
csc¯¹
Power Rule
Given:
What happens to the 2? Recall that f'(c) where c is a Constant will be 0. Thus, 2 is omitted from the resultant Derivative.
Sum Rule
Where f and g are both Differentiable:
Difference Rule
Where f and g are both Differentiable:
Product Rule
Where f and g are both Differentiable:
Quotient Rule
Where f and g are both Differentiable:
Chain Rule
The above are used to evaluate Derivatives for Combined Functions.
The Chain Rule is the primary tool for evaluating the Derivative of a Composite Functions (Composition of two or more Functions).
Given two Functions f and g where both are Differentiable and such that f is Differentiable at g(x):
The Derivative of the Composite Function is given by:
And, where y is the Function of u and u is the Function of x:
Also note the following relationship:
dy/dx can be obtain through a combination of the Chain and Power Rules.
Inverse Functions
Where f¯¹ is the Inverse Function of f:
The Derivative of the Inverse Function of f is then given by:
Exponential Functions
The following equations hold:
As do:
Logarithmic Differentiation
Example. Given a Function f:
- Taken the Natural Logarithm of both sides before Differentiation:
- This allows simplification before any complicated Differentiation attempt:
- Now find the Derivative:
- Now solve. Eventually you'll be left with a dangling
y:
- Replace with the original equation above to eliminate
yand only leavex:
Resources and Links
Math: Calculus - Advanced Topics
Implicit Differentiation
Implicit Functions allow for Variables (y, x, etc.) to be defined dependently (1 = y + x) as opposed to independently (y = -x + 1)) of each other.
Implicit Differentiation:
- To find the Derivative of a Function
yImplicitly in terms ofx. - Allows for tbe Derivatives of Graphs or curves that aren't Functions to be expressed (e.g. - a graphed Circle).
Example
Consider the following Implicit Function (to be more precise a Function where
yis implicitly defined by the following equation):$$\displaystyle x^2 + y^2 = 25$$Differentiate both sides of the equation:
$$\displaystyle \frac{d}{dx}(x^2 + y^2) = \frac{d}{dx}(25)$$Given that the Function's a Combined Function, use the Combined Function Sum Rule (from above):
$$\displaystyle \frac{d}{dx}(x^2) + \frac{d}{dx}(y^2) = \frac{d}{dx}(25)$$The Derivative of a Constant is
0so replace the right-hand side:$$\displaystyle \frac{d}{dx}(x^2) + \frac{d}{dx}(y^2) = 0$$Use the Power Rule on the left-hand side:
$$\displaystyle 2x^1 + \frac{d}{dx}(y^2) = 0$$ $$\displaystyle 2x^1 = 2x$$ $$\displaystyle 2x + \frac{d}{dx}(y^2) = 0$$Simplify the second left-hand term:
$$\displaystyle \frac{d}{dx}(y^2) = 2y\frac{dy}{dx}$$ $$\displaystyle 2x + 2y\frac{dy}{dx} = 0$$
This is through the Chain Rule.
- Simplify and express the result in
dy/dxform:$$\displaystyle 2y\frac{dy}{dx} = -2x$$ $$\displaystyle y\frac{dy}{dx} = -x$$ $$\displaystyle \frac{dy}{dx} = -x/y$$
Marginal Cost
Given a Cost Function C such as:
The cost of producing the
n-th unit is given by the following equation (producing$ cost):$$\displaystyle C(X_{n}) - C(X_{n-1})$$The average rate of change of total cost for the
n-th unit is given by the following equation (producing:$/unit):$$\displaystyle \frac{C(X_{n}) - C(X_{n-1})}{X_{n} - X_{n-1}}$$The instantaneous rate of change of total cost when
nunits have been produced is given by the following equation (producting$/unit):$$\displaystyle \lim_{h \to 0} \frac{C(X_{n}-h) - C(X_{n})}{h}$$
Tangent Line Problem
Given: a Function y = f(a) and point (a, f(a)) within that Function, a Tangent Line can be computed using the following equation:
This can also be thought of as (where m is the Slope):
One can also think of this as finding the Derivative of f then plugging in a to calculate b in the equation:
Given an equation f(x) = 2x, to find the Tangent Line at (2, 4):
- Compute the Derivative of
f(f'(x)). - Solve for
b:4 = f'(2) * 2 + b. - The resultant Tangent Line:
y = f'(2) * x + b.
Normal Line Problem
To find the Normal Line from points (a, f(a)), take the Negative Reciprocal of the Tangent Line's Slope and plug in (a, f(a)).
Negative Reciprocals can be obtain by swapping Numerators and Denominators, then the Sign:
Linear Approximation
This technique involves two steps:
- To define a Tangent Line at
a. - Then to use that Tangent Line to approximate some other number (called the Approximate).
Definitions
Linear Approximation - calculate a Tangent Line at
athat will be used to Approximate other values once defined:$$\displaystyle y = f(a) + f'(a)(x-a)$$ $$\displaystyle L(x) = f'(a)(x-a) + f(a)$$Y-Differential - the distance up to the Tangent Line:
$$\displaystyle dy = f'(x) \cdot dx$$Calculating the Amount of Error - calculating how accurate the Approximation is:
$$\displaystyle \Delta y = f(a + dx) - f(a)$$
Example
Given a Function:
$$\displaystyle f(x) = (6 + x)^{\frac{3}{2}}$$Approximate that Function,
f, ata = 2:$$\displaystyle L(x) = f'(a)(x-a)+f(a)$$ $$\displaystyle L(x) = f'(2)(x-2)+f(2)$$Solve for
f'(a)(f'(2)) andf(a)(f(2)).$$\displaystyle f'(2) = \frac{1}{12}$$ $$\displaystyle f(2) = 2$$Resulting in:
$$\displaystyle L(x) =\frac{1}{12}(x-2)+2$$Now, Approximate the number
7.95^(1/3)by plugging it into the Tangent Line defined above:$$\displaystyle L(x) =\frac{1}{12}(7.95^{\frac{1}{3}}-2)+2$$
Forms and Ratios of Functions
Recollect Limit behavior:
0represents a number arbitrarily close to zero.Csome other numeric Constant.+∞represents a number that grows indefinitely/arbitrarily.-∞represents a number that grows negatively indefinitely/arbitrarily.
W.R.T. to L'Hôpital's Rules 0, +/-∞ are relevant evaluations. We will compare two Functions f and g.
What about scenarios like the following?
If f, g evaluated to ∞ and 0, how would we approach finding a solution? The prior Rules apply to Constants and other defined operations.
Determinate Forms
Evaluates to a single 0, C or +/-∞ (and is thus directly Differentiable, defined, and solved using the prior Rules).
Determinate Forms (where the left-hand side is the Limit of f, the middle operator the relevant infix operation between f and g, and the right g):
0+00-00×0+/-∞ × +/-∞0/∞,c/∞∞/0,∞/cc × ∞, c > 00^∞n^∞, n ≠ 0∞^∞
Indeterminate Forms
Does not evaluate to 0 or +/-∞ and is undefined.
Indeterminate Forms (where the left-hand side is the Limit of f, the middle operator the relevant infix operation between f and g, and the right g):
∞-∞0/0+/-∞/+/-∞0 × ∞0^0∞^01^∞
L'Hôpital's Rule
L'Hôpital's Rules apply when two Functions f and g are Diiferentiable, the right-hand Limit exists, they are equal to each other, and they both equal 0, -∞, ∞ (Indeterminate Form).
L'Hôpital's Rule concerns Limit Ratios:
0/0 Rule
Where f and g are Diiferentiable over an Open Interval including or excluding a:
If:
Then:
if the Limit on the right exists.
This is called L'Hôpital's 0/0 Rule.
∞/∞ Rule
Where f and g are Diiferentiable over an Open Interval including or excluding a:
If:
Then:
if the Limit on the right exists. Note that the Sign must match.
This is called L'Hôpital's ∞/∞ Rule.
Extensions
Sometimes, f and g may appear to be unsuitable for L'Hôpital's 0/0 or ∞/∞ Rule (although f, g are Indeterminate Ratio Forms).
However, upon closer inspection f, g might be assuaged into an acceptable Form. So, check before you conclude otherwise.
Helpful to rewrite a Function into Ratio Form (converts f into a Fraction):
Maxima and Minima
- A Function
fhas a Local Maximum atcif there exists an Open IntervalIcontainingcsuch thatIis contained in the Domain offandf(c) ≥ f(x)for allx ∈ I. - A Function
fhas a Local Minimum atcif there exists an Open IntervalIcontainingcsuch thatIis contained in the Domain offandf(c) ≤ f(x)for allx ∈ I. - A function
fhas a Local Extremum atciffhas a Local Maximum atcorfhas a Local Minimum atc.
Critical Number
We say that c is a Critical Number of f if f'(c) = 0 or f'(c) is undefined.
- E.g. - The Zeroes of the First Derivative of
f.
Fermat's Theorem
If f has a Local Extremum at c and f is Differentiable at c, then f'(c) = 0.
Mean Value Theorem
- Let
fbe a Continuous Function over the Closed Interval[a,b]and Differentiable over the Open Interval(a,b). - There then exists at least one Point
cwherec ∈ (a,b)such that:
Rolle's Theorem
- Observe that the following is a special case of the Mean Value Theorem.
- Let
fbe a Continuous Function over the Closed Interval[a,b]and Differentiable over the Open Interval(a,b)andf(a) = f(b). - There then exists at least one Point
cwherec ∈ (a,b)such thatf'(c) = 0.
Concavity
Test for Concavity
- Let
fbe a Function that is twice Differentiable over an IntervalI. - If
f′′(x) > 0for allx ∈ I, thenfis Concave Up overI. - If
f′′(x) < 0for allx ∈ I, thenfis Concave Down overI.
First Derivative Test
Sppose that f is a Continuous Function over an Interval I containing a Critical Point (Critical Number) c. If f is Differentiable over I, except possibly at c, then f(c) satisfies one of the following descriptions:
- If
f′changes sign from positive whenx < cto negative whenx > c, thenf(c)is a Local Maximum off. - If
f′changes sign from negative whenx < cto positive whenx > c, thenf(c)is a Local Minimum off. - If
f'has the same sign forx < candx > c, thenf(c)is neither a Local Maximum nor a Local Minimum off.
Second Derivative Test
Suppose f′(c) = 0, f′′ is Continuous over an Interval containing c.
- If
f′′(c) > 0, thenfhas a Local Minimum atc. - If
f′′(c ) < 0, thenfhas a Local Maximum atc. - If
f′′(c) = 0, then the test is inconclusive.
Resources and Links
- https://math.asu.edu/mat265
- https://openstax.org/books/calculus-volume-1/pages/3-3-differentiation-rules
- https://cdn.blot.im/folder/v-fe12c195/blog_8fcd421159a44b99bdecdde569644473/_spivak/ch10.pdf
- https://www.sfu.ca/math-coursenotes/Math%20157%20Course%20Notes/sec_Hopital.html
- https://openstax.org/books/calculus-volume-1/pages/4-4-the-mean-value-theorem
Math: Calculus - Anti-Derivatives
Indefinite Integrals (Anti-Derivatives) are often used for approximating calculated Areas.
Anti-Derivatives
For a Function f, find a Function f' such that:
For example:
So, the left-hand side (x^3) is the Anti-Derivatives for 3x^2. And:
Is the Family of Anti-Derivatives for 3x^2.
Worked Example
Notes
Riemann Sums and Approximating Accumulation
Left, Right, Middle Riemann Sums divide an Interval into n Rectangles allowing of the Area under a Curved Line to be Approximately calculated.
The more the better (the more accurate) and that's the key intution is that as this number goes to Infinity, the more accurate the Approximation will be.
- Left - we use the left-most Coordinate to compute each Y Value and Rectangle.
- Right - we use the right-most Coordinate to compute each Y Value and Rectangle.
- Middle - we use the middle Coordinate (
Left - Right / 2) to compute each Y Value and Rectangle.
- Given a partition
Δxthat divides an Interval[a,b]intox0, ..., xn. - We can Approximate the Area under a boundary defined by a Function
f(wherex0is some initial value) using the following method:
If some X Value isn't an Ordinal, we can multiply or subtract to the relevant Left, Right, or Middle Coordinate.
Resources and Links
Math: Calculus - Definite Integrals
Definite Integrals are often used to exactly calculate Area (using Geometry).
Definition
if f(x) is a Function defined Interval [a,b], the Definite Integral of f from a to b is given by:
provided the Limit exists. If the Limit exists, the Function f(x) is said to be Integrable on [a,b], or is an Integrable Function.
Equivalences
Properties
Zero Interval:
Reversal of Limits Rule:
Sum Rule:
Difference Rule:
Constant Multiple Rule:
Additive Rule:
Comparison Theorem
If f(x) ≥ 0 for a ≤ x ≤ b, then:
If a ≤ x ≤ b, then:
If m and M are constants where m ≤ f(x) ≤ M for a ≤ x ≤ b, then:
Geometric Solutions
- When using Geometric approaches, Areas
y <= 0are substracted from Areasy >= 0. - When the Function and Interval don't touch or intersect the Y-Axis:
- Add the (gap) Area below to the Area of the compute Function.
For example:
1/4 the Area of the computed Circle plus the 4 by 2 Region below the Semi-Circle.
Fundamental Theorem of Calculus
In simple cases the Fundamental Theorem of Calculus can be expressed as:
- The Derivative of the Definite Integral of
f(x)is just the original Function with the Upper Limit term (b, above) replacing the Variable of Integration (dt, above). - If the Upper Limit is an expression, use the FTC Chain Rule (below).
- If both the Upper Limit and the Lower Limit are expressions, use Part Two (below).
- Solve using the FTC Chain Rule for the Upper Limit and the Lower Limit then substract.
Part One
If f(x) is Continuous over an Interval [a,b] and the Function F(x) is defined by:
then the following holds over (a,b):
Part Two
If f is Continuous over an Interval [a,b] and the Function F(x) is any Anti-Derivative of f(x) then:
FTC Chain Rule
If the Upper Limit is itself an expression (say 2+5x), we must apply the FTC Chain Rule:
where u is the expression 2+5x.
Note: one does NOT subtract
F(a)fromF(b)when using this approach (onlyF(u) * du/dx).
Worked Example
By the Reversal of Limits Rule:
By Substitution:
By Substitution:
Mean Value Theorem of Derivatives
Resources and Links
Math: Calculus - Additional Study Notes
Some Equivalences
By the Chain Rule:
Logarithms and the Exponential Function Limit:
Techniques
Recapitulating and summarizing some prior notes.
Left Limit of a Function With Absolute Values
- Example:
f(x) = |x-5|. - The Left Limit of
fas it goes to5is-(x-5)or-x+5.
Tangent Line Problem
- Find the Derivative of
f. The Slope,m, of the Tangent Line equalsf'. - Plug the X and Y values into
y = mx + bthen solve forbto get the Slope Intercept Form. - Slope Intercept Form:
y = f'(x)x + b.
Related Rates - Volume
V = 4/3 * pi * r^3:d/dtofV(dV/dt).dV/dtis given (say5 ft/s).- Solve this down to
dr/dt.
- Then, calculate the actual
V(not the Derivative). Say10 Minutesin or10 * 60 * 5.- Solve for
ratV(not the Derivative):10 * 60 * 5 = 4/3 * pi * r^3.
- Solve for
- One can then solve
dr/dtby substitutingr.
Related Rates - Particle
- Solve in three pieces:
dx/dt,dD/dt(D = r),dy/dt. D = sqrt(x^2 + y^2):dD/dt = 1/2(x^2 + y^2)^(-1/2) * (2x * dx/dt + 2y * dy/dt).
- Some equation will be supplied to define the curve the Particle is moving on: say
y = 3*sqrt(3x + 1).- Find the Derivative
dy/dx.
- Find the Derivative
dx/dtwill be given - it's the Velocity of the Particle at the instant in question.- Plug
dx/dtanddy/dtintodD/dtto obtain the answer.
Linear Approximations
- For some say
x = 1, findf(1)andf'(1). - Or,
L(x) = f'(1)(1-1) + f(1)(L(x) = f'(x)(x-a) + f(a)).
Mean Value Theorem Estimations
- Given say Continuous Function
f. - One estimates the Mean Value Theorem for say:
f(5)andf(1)like so:- Suppose
-5 <= f'(x) <= 1. - One knows
5-1=4. - So, the Lower Bound is
(5-1) * -5. - The Upper Bound is
(5-1) * 1.
- Suppose
- So,
-20 <= f(5)-f(1) <= 4.
Anti-Derivative Fraction Expansion
It's generally better to expand the Fraction like so:
When solving an Anti-Derivative (rather than attempting to reverse the Quotient Rule).
Once one's expanded the Divisor out, remove Quotients with Exponents by rewriting them as Negative Powers like so:
Integral of Euler's Constant to a Power
Since:
Upper Limit Evaluation
Remember that using the Fundamental Theorem of Calculus on an Upper Limit equation doesn't involve subtracting F(a) from F(b) (only F(u) * du/dx).
Upper and Lower Limit Evaluation
Where u is the Upper Limit expression and l the Lower Limit expression: F(u) * du/dx - F(l) * dl/dx.
Displacement and Distance
Displacement - net distance traveled:
Distance - total distance traveled. Use the Absolute Value: