diff --git a/documents/by-course/math-4b/course-notes/main.typ b/documents/by-course/math-4b/course-notes/main.typ index e2c5949..992818f 100644 --- a/documents/by-course/math-4b/course-notes/main.typ +++ b/documents/by-course/math-4b/course-notes/main.typ @@ -835,3 +835,65 @@ To find gamma, we can simply use inverse trig functions. Which makes $cos(5t + pi - arctan(1/2))$ negative. ] + += Lecture #datetime(day: 18, year: 2025, month: 2).display() + +== Linear systems of differential equations + +Consider a matrix $A$ and solution vector $x$. +$ + x'(t) = A(t) x(t) +$ + +#fact[Superposition principle for linear system][ + If $x^((1)) (t)$ and $x^((2)) (t)$ are solutions, then + $ + c_1 x^((1)) (t) + c_2 x^((2)) (t) + $ + are also solutions. +] + +=== Homogenous case + +This is when $g(t) = 0$. I want to solve for $arrow(x)' = A arrow(x)$, where +$ + arrow(x) = vec(mu_1 (t), mu_2 (t), dots.v, mu_n (t)) +$ +Similar to the scalar case, we look for solutions in terms of exponential +functions. Guessing + +$ + arrow(x) (t) = e^(r t) arrow(v) \ + arrow(x)'(t) = r e^(r t) arrow(v) = A e^(r t) arrow(v) \ + r arrow(v) = A arrow(v) \ + (A - r I) arrow(v) = 0, arrow(v) != 0 +$ + +If there are non-trivial solutions then $A$ must have determinant 0. + +$ + det (A - r I) = 0 +$ + +This is the eigenvalue equation for $A$! + +#example[ + Find a fundamental set of solutions. FIrst find the eigenvalues and + corresponding eigenvectors of $A$. + + $ + x'(t) = A x(t), A = mat(2,1;1,2) + $ + + Find eigenvalues of $A$. + + $ + A - lambda I = mat(2 - lambda, 1; 1, 2- lambda) \ + |a - lambda I| = (2 - lambda)^2 - 1 = 0 \ + 2 - lambda = plus.minus 1 \ + lambda = cases(1,3) + $ + + Now we want the eigenvectors for our eigenvalues. Find an eigenvector + corresponding to $lambda_1 = 1$. +] diff --git a/documents/by-course/math-6a/course-notes/main.typ b/documents/by-course/math-6a/course-notes/main.typ index b13702b..9d06b77 100644 --- a/documents/by-course/math-6a/course-notes/main.typ +++ b/documents/by-course/math-6a/course-notes/main.typ @@ -201,3 +201,75 @@ $ (diff F) / (diff x) = diff / (diff z) (3x^2 + 5 y z + z^3) = diff / (diff z) z^3 = 0 + (5 (diff y) / (diff x) z + 5y) + 3z^2 \ (diff y) / (diff z) = - (5y + 3z^2) / (5z) $ + += Lecture #datetime(day: 18, year: 2025, month: 2).display() + +== Critical points + +When optimizing in 2D, the strategy depends on whether we're + +- optimizing for all of $RR^2$ (or a region in $RR^2$) +- optimizing on a constraint (like a curve through $RR^n$) + +We find critical points where the tangent plane is "flat": $m_x = 0$ and $m_y = +0$. + +We classify critical points using the determinant of the gradient. + +$ + D = f_(x x) f_(y y) = f_(x y)^2 +$ + +- if $D >0$ and $f_(x x) (x_0, y_0) > 0$, then $f(x_0, y_0)$ is a relative minimum. +- if $D > 0$ and $f_(x x) (x_0, y_0) < 0$, $f(x_0, y_0)$ is a relative maximum. +- if $D < 0$ then $f(x_0, y_0)$ is neither and we call it a saddle point. +- if $D = 0$ then we don't know + +== Lagrange multipliers + +Optimizing constrained curves. Idea: navigate along the curve and look for where +the directional derivative is zero. + +#example[ + Find the highest and lowest points on $f(x,y) = 81x^2 + y^2$ with the + constraint $x^2 + y^2 = 0$. + + For notational purposes, we'll call $g(x,y) = 4x^2 + y^2$ and keep in mind + we're looking for $g(x,y) = 9$. + + 1. Find the gradients of $f$ and $g$. + $ + vec(f_x,f_g) &= vec(162x,2y) \ + vec(g_x,g_y) &= vec(8x,2y) + $ + 2. We want to find the points where the gradients "align", i.e. we want these + vectors to be parallel, that is: + $ + arrow(F) = lambda arrow(G) \ + 162x = 8x dot lambda \ + 2y = 2y dot lambda + $ + Remember to keep the constraint! + $ + 4x^2 + y^2 = 9 + $ + Breaking it down into cases, + $ + 162 = 8lambda => lambda = 81 / 4 "for" x != 0 + $ + which implies + $ + 2y (lambda - 1) 0 \ + y = 0 + $ + since $lambda - 1$ is nonzero. So if $x$ is nonzero, $y$ must be zero. + + $ + 4x^2 = 9 \ + x = plus.minus 3 / 2 + $ + Now consider when $x = 0$. Then $y = plus.minus 3$. So our critical points + are $(plus.minus 3/2, plus.minus 3)$. Finally, just plug in these 4 + critical points into $f$ and find the biggest/smallest. + +] diff --git a/documents/by-course/math-8/course-notes/main.typ b/documents/by-course/math-8/course-notes/main.typ index a6e2894..f67816e 100644 --- a/documents/by-course/math-8/course-notes/main.typ +++ b/documents/by-course/math-8/course-notes/main.typ @@ -688,3 +688,322 @@ $ z = x + (b c - a d) / (b d + 1) $ $ z = (x + y) / 2 $ Then $(x + y)/2$ is obviously rational and strictly between $x$ and $y$. ] + += Induction + +Induction is a way to prove that a statement is true for all $NN$. Formally, it +is introduced like this: say you have a set $S subset.eq NN$ such that $1 in +S$. Then, if $n in S => n + 1 in S$, $S = NN$. Usually we plug $n$ into a +proposition $P$ to make it more useful for proving statements. If $(forall n in +S)(P(n))$, and we can show $S = NN$ by induction, then $P(n)$ is true for all +$n in NN$. + +Induction consists of two main parts. First, we have to show that $1 in S$. +This is the _base case_. Then, we assume the _inductive hypothesis_, $n in S$. +If we can prove, using the inductive hypothesis, that $n in S$ implies that $n ++ 1$ in $S$, then we'll have sufficient justification for $S = N$. When proving +a statement in practice, if $S$ is the set of all inputs to $P(n)$ that make it +true, we show that $P(1)$ is true ($1 in S$) and then show that $P(n) => +P(n+1)$, which implies $(forall n in NN) P(n)$. + +There are two equivalent formulations of induction, the principle of +mathematical induction (PMI, also called _weak induction_), and the principle +of complete induction (PCI, also called _strong induction_). They are +equivalent, but in some cases one is much more straightforward to show than the +other. + +The previous strategy we discussed was _weak induction_, named such because we +need only show $P(1) and P(n) => P(n+1)$. _Strong induction_ requires us to +show a much stronger result, but also allows us to make a stronger assumption. + +#definition[Strong induction][ + If ${1,2,3,...,n-1} subset.eq S => n in S$, then $S = NN$. +] + +Essentially in strong induction we assume that every natural up to $n$ is in +$S$, and if we can show that this implies $n$ is also in $S$, we have $S = NN$. +Note that in this case we do not have to show $1 in S$, but this is implied. +When proving a proposition $P$, we have to prove $P(1) and P(2) and ... and +P(n-1) => P(n)$, but we can assume the strong inductive hypothesis $P(1) and +P(2) and ... and P(n-1)$. + +#example[Game theory of Nim][ + In the game of _Nim_, two players take turns taking coins from two piles of + $n$ coins each. If there are $m$ coins in a pile, a player may choose to take + $1,2,3,...,m$ coins, *except* $m - 1$ coins. That is, a player may take any + nonzero amount, but may not leave exactly one coin left in the pile. The + player to take the last coin in play wins. + + Example game: if there are 6 coins on the left and 8 coins on the right, + player 1 goes first and takes 4 coins from the left. Player 2 takes the + remaining 2 coins on the left. Player 1 takes all 8 coins from the right and + wins. + + Prove that Player 2 has a winning strategy in all games of _Nim_. + + This is actually a somewhat unexpected way in which strong induction can be + very useful. Let $S$ be a set of the natural numbers where Player 2 has a + winning strategy when there are $n in S$ coins left in both piles. + + Suppose $m$ is a natural number and ${1,2,3,...,m-1} subset.eq S$. This is + our inductive hypothesis, we assume that Player 2 has a winning strategy for + when the game starts with $1,2,3,...,m-1$ coins in each pile. Now we seek to + show that this implies that Player 2 has a winning strategy when there are + $m$ coins in the pile. For the special case when $m = 1$, Player 1 takes 1 + coin from either pile and Player 2 takes both, winning the game. Otherwise, + for $m > 1$, if Player 1 takes $m$ coins from a pile, Player 2 takes all the + coins in the other pile, winning. If Player 1 takes $j$ coins from either + pile where $1 <= j < m - 1$, leaving $m - j > 1$ coins in the pile, Player 2 + can take $j$ coins from the other pile, leaving both piles with $m - j$ + coins. This is essentially a new game of Nim with $m - j$ coins in each pile. + Then $m - j in {1,2,3,...,m-1}$ since $j <= 1 < m-1$, so by our inductive + hypothesis Player 2 has a winning strategy from this point on. Therefore + Player 2 has a winning strategy when $m$ coins are in each pile. + Since ${1,2,3,...,m-1} subset.eq S => m in S$, by strong induction, $S = NN$ + and Player 2 has a winning strategy for all possible games of _Nim_. +] + +#example[A hint for the fundamental theorem of arithmetic][ + Prove that all natural numbers can be expressed as the product of primes. + + #proof[ + Let $m$ be a natural number. Note that $m = 2$ is prime so its the product + of itself and 1. Now assume that all natural numbers $n$ such that $1 < n < + m$ can be written as the product of primes. Then $m$ is either prime, in + which case its prime factors are $1 dot m$, or $(exists s,t in + {1,2,...,m-1})(m = s t)$. Then by our inductive hypothesis both $s$ and $t$ + can be written as the product of primes, so $m$ is also the product of + primes. By strong induction, we conclude all natural numbers can be written + as the product of primes. + ] +] + +== Well ordering principle + +This is another property that characterizes $NN$. + +#fact[Well ordering principle][ + Every nonempty subset of $NN$ has a smallest element. +] + +We demonstrate the WOP in an alternative proof of +@fundamental-thm-arithmetic-hint. + +#example[ + All natural numbers can be expressed as the product of primes. + + #proof[ + Suppose there exists some non-empty set $S subset.eq NN$ that contains all + of the natural numbers which cannot be expressed as a product of primes. + By the WOP, there is a least number in this set, $T in S$. $T$ cannot be + prime because it would be the product of $1 dot T$, so it must be + composite. Then $T = s t$ for some natural numbers $s,t$, which are less + than $T$. But $T$ is the least element of $S$ so neither $s$ nor $t$ are in + $S$, and therefore they both have prime factorizations. But this implies + that $T$ also has a prime factorization, a contradiction. Therefore no such + set $S$ can exist, and all natural numbers have a prime factorization. + ] +] + +#theorem[The division algorithm][ + For all integers $a$ and $b$, with $a != 0$, there exist unique integers $q$ + and $r$ such that $b = a q + r$ and $0 <= r < |a|$. + + #proof[ + Let us consider the case where $a > 0$. Then we have a set + + $ + S = {b - a k, k in ZZ, b - a k >= 0} + $ + + It follows that we should exclude 0 from $S$ because otherwise if $0 in S$, + $b - a k = 0$ for some integer $k$, and $a | b$, so $b = a dot b/a$. + + In our restricted $S$, there is a least element, call it $r$. Then for some + integer $q$, $a q + r = b$. We know that $r > 0$ so let's show $r < |a|$. + Since we're considering only $a > 0$ for simplicity, we just show $r < a$. + If $r >= a$, then either $0 in S$ when $r = a$ because $a q + a = b$ + implies that $a | b$, or, when $r > a$, there exists another element in + $S$, $b - a (q + 1)$. This is a contradiction since we assumed $b - a q$ + was the smallest element in $S$ and clearly $b - a q - a$ is smaller. + Therefore $r < |a|$. + + Now we show the uniqueness of $q, r$. Suppose there were other integers + satisfying the properties of $q$ and $r$, $q'$ and $r'$. Then we have + + $ + r' >= r + $ + without loss of generality (otherwise just relabel). Then $a q + r = a q' + + r'$, so $a(q - q') = r' - r$. Then $a$ divides $r' - r$. + ] +] + +== Relations, partitions + +#definition[ + A relation on a set $A$ is a set of ordered pairs $(a,b)$ where $a,b in A$. A + relation from a set $A$ to a set $B$ is set of ordered pairs $(a,b)$ where $a + in A$ and $b in B$. +] + +#abuse[ + If $R$ is a relation from $A$ to $B$, for $a in A$ and $b in B$ where $(a,b) + in R$, we can abbreviate it $a R b$. +] + +#definition[ + For any set $A$, the identity relation on $A$ is the set + $ + I_A = {(a,a) : a in A} + $ +] + +#definition[ + The domain of the relation $R$ from $A$ to $B$ is the set + $ + "Dom"(R) = {x in A : (exists y in B)(x R y)} \ + $ + The range is + $ + "Rng"(R) = {y in B : (exists x in A)(x R y)} + $ +] + +So the domain of $R$ is the set of all first coordinates and the range is the +set of all second coordinates. + +#theorem[ + 1. $"Dom"(R^(-1)) = "Rng"(R)$ + 2. $"Rng"(R^(-1)) = "Dom"(R)$ +] + +#definition[ + Let $R$ be a relation from $A$ to $B$, let $S$ be a relation from $B$ to $C$. + The composite of $R$ and $S$ is + + $ + S compose R = {(a,c) : (exists b in B)((a,b) in R and (b,c) in S)} + $ +] + +== Equivalence relations + +Let $A$ be a set and $R$ a relation on $A$. + +We say $R$ is reflexive on $A$ if $forall x in A, x R x$. $R$ is symmetric if +$forall x,y in A$, if $x R y$, then $y R x$. $R$ is transitive if $forall x,y,z +in A$, if $x R y$ and $y R z$, then $x R z$. + +#theorem[ + Let $A$ be a set. For the power set $cal(P)(A)$, the relation "is a subset of" + is reflexive on $cal(P)(A)$ and transitive but not symmetric. +] + +#definition[ + A relation $R$ on a set $A$ is an equivalence relation on $A$ if $R$ is + reflexive on $A$, symmetric, and transitive. +] + +We make an equivalence relation when we think of objects as being related by +having the same property. + +An equivalence relation on a set divides the set into subsets of related +elements. + +#definition[ + Let $R$ be an equivalence class on a set $A$. For $x in A$, the equivalence + class of modulo $R$ (or $x mod R$) is the set + + $ + overline(x) = {y in A : x R y} + $ + + Each element of $overline(x)$ is a *representative* of the class. The set + $ + A \/ R = {overline(x) : x in A} + $ + of all equivalence classes is called $A "modulo" R$. +] + +#theorem[ + Let $R$ be an equivalence relation on a nonempty set $A$. For all $x$ and $y$ + in $A$, + + 1. $x in overline(x)$ and $overline(x) subset.eq A$ + 2. $x R y$ if and only if $overline(x) = overline(y)$ + 3. $x cancel(R) y$ if and only if $overline(x) sect overline(y) = emptyset$ +] + +== Congruence relations + +Now we define congruence relations on $ZZ$ and show that congruence mod $m$ is +an equivalence relation. We describe its equivalence classes. + +#definition[ + Let $m$ be a fixed positive integer. For $x,y in ZZ$, we say $x$ is congruent + to $y$ modulo $m$ and write $x = y (mod m)$ if $m$ divides $(x-y)$. The number + $m$ is called the modulus of the congruence. +] + +#theorem[ + For every fixed positive integer $m$, congruence modulo $m$ is an equivalence + relation on $ZZ$. +] + +#proof[ + 1. Reflexivity. Let $x$ be an integer. We show $x = x (mod m)$. $m dot 0 = 0 = x - x$, $m | x - x$. + 2. For symmetry, suppose $x = y (mod m)$. Then $m | x - y$. Thus $(exists k)(x - y = k m)$. But $-(x-y) = -(k m)$, or $y - x = (-k) m$. So $m | y - x$ so $y = x (mod m)$ + 3. Suppose $x = y (mod m)$ and $y = z (mod m)$. Thus $m | x - y$ and $m | y - z$. Thus $m | x - y + y - z <=> m | x - z$ so $x = z (mod m)$. So congruence modulo $m$ is transitive. +] + +#definition[ + The set of equivalence classes for the relation congruence modulo $m$ is + denoted $ZZ_m$. +] + +#theorem[ + Let $m$ be a fixed positive integer. Then + + 1. for integers $x$ and $y$, $x = y (mod m)$ if and only if the remainder when $x$ is divided by $m$ equals the remainder when $y$ is divided by $m$ + 2. $ZZ_m$ consists of $m$ distinct equivalence classes. +] + +The equivalence classes of $ZZ_m$ $overline(0), overline(1), ..., +overline(m-1)$ which are exactly all of the possible remainders when integers +are divided by $m$. For this reason the elements of $ZZ_m$ are sometimes called +the residue classes modulo $m$. + +== Partitions + +#definition[ + Let $A$ be a nonempty set. $cal(P)$ is a partition of $A$ if $cal(P)$ is a set of subsets of $A$ such that + 1. if $X in cal(P)$, then $X != emptyset$ + 2. if $X in cal(P)$ and $Y in cal(P)$, then $X = Y$ or $X sect Y = emptyset$ + 3. $union.big_(X in cal(P)) X = A$ +] + +In other words a partition of a set $A$ is a pairwise disjoint collection of +nonempty subsets of $A$ whose union is $A$. + +#theorem[ + If $R$ is an equivalence relation on a nonempty set $A$, then $A\/R$ is a + partition of $A$. +] + +#proof[ + Every equivalence class $overline(x)$ is a subset of $A$ and is nonempty + because it contains $x$. Any two equivalence classes are either equal or + disjoint. Also, + $ + union.big_(x in A) overline(x) subset.eq A + $ + because each $overline(x) subset.eq A$. To prove $A subset.eq union.big _(x in A) overline(x)$, suppose $y in A$. Because $y in overline(y)$, then + $ + y = union.big_(x in A) overline(x) + $ + Thus, + $ + A = union.big_(x in A) overline(x) + $ +]