commit allerede lavet opgaver

This commit is contained in:
2025-11-26 15:37:45 +01:00
parent e1a4e65d59
commit ed10a5c1b9
51 changed files with 1038 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,61 @@
Section 6.4: 7, *9*, *11*, 17, *21*, 23, *29, 33, 35, 37, 39*
= Exercise 7
What is the coefficient of $x "in" (2-x)^(19)$
= Exercise 9
What is the coefficient of $x^101y^99 "in the expansion of" (2x-3y)^200$
*Answer:*
$ -200!/(101! dot 99!)dot 2^101 dot 3^99 = -2^101 dot 3^99 dot mat(200;99) $
= Exercise 11
Use the binomial theorem to expand $(3x-2y³)$ into a sum of terms of the form $c x^a y^b$, where $c$ is a real number and $a$ and $b$ are nonnegative integers
*Answer:*
$ sum^5_(k=0)mat(5;k)(3x^4)^(5-k) (-2y^3)^(k) =\
243x^20-81dot x^16dot 2y^3 dot 5 + 27 dot x^12dot 4y^6dot 10 - 9x^8dot 8y^9dot 10 + 3x^4 dot 16y^12dot 5 -32y^15 =\
243x^20-810x^16y^3+1080x^12y^6-720x^8y^9+240x^4y^12-32y^15 $
= Exercise 17
What is the row of Pascal's triangle containing the binomial coefficients $mat(9;k),0<=k<=9$
= Exercise 21
Show that if $n$ and $k$ are integers with $1<=k<=n$, then $mat(n;k)<=n^k / 2^(k-1)$
*Answer:*
We know that $mat(n;k)$ is $n!/((n-k)!k!) = (n(n-1)(n-2)dots n-k+1)/(k(k-1)(k-2)(k-3)dots 2) <= (n dot n dot n dot dots)/(2 dot 2 dot 2)$
= Exercise 23
Prove Pascal's identity, using the formula for $mat(n;r)$
= Exercise 29
Let $n$ be a positive integer. Show that $ mat(2n;n+1)+mat(2n;n) = mat(2n+2;n+1) / 2 $
*Answer:*
We know:
$mat(2n;n+1)+mat(2n;n)=mat(2n+1;n+1)$
$mat(2n+1;n+1)=1/2dot (mat(2n+1;n+1)mat(2n+1;n+1))=mat(2n+2;n+1)/2$
= Exercise 33
Give a combinatorial proof that $sum_(k=1)^n k mat(n;k)=n 2^(n-1)$.
_Hint: Count in two ways the number of ways to select a committee and to then select a leader of the committee._
*Answer:*
To select a committee, you have $2^(n-1)$ choices (n-1 because when you have n=1, then the choices are $2^0=1$) and then you select one from the `n` people in the committee.
= Exercise 35
Show that a nonempty set has the same number of subsets with an odd number of elements as it does subsets with an even number of elements
= Exercise 37
In this exercise we will count the number of paths in the $x y$ plane between the origin $(0,0)$ and point $(m,n)$, where $m$ and $n$ are nonnegative integers, such that each path is made up of a series of steps, where each step is a move unit to the right or a move unit upward. (No moves to the left or downward are allowed.) Two such paths from $(0,0)" to "(5,3)$ are illustrated here.
#image("Exercise 6.4-37.png")
a) Show that each path of the type described can be represented by a bit string consisting of $m$ 0s and $n$ 1s, where a 0 represents a move one unit to the right and a 1 represents a move one unit upward.
b) Conclude from part (a) that there are $mat(m+n;n)$ paths of the desired type
= Exercise 39
Use Exercise 37 to prove Theorem 4. _Hint: Count the number of paths with $n$ steps of the type described in Exercise 37. Every such path must end at one of the points $(n-k,k)$ for $k=0,1,2, dots, n$._
Theorem 4: Let $n$ and $r$ be nonnegative integers with $r<=n$. Then: $mat(n+1;r+1)=sum^n_(j=r) mat(j;r)$

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

View File

@@ -0,0 +1,178 @@
#import "@preview/cetz:0.4.2"
Section 6.4
#title[Binomial coefficients, formula and identities]
= Binomial coefficient
From last week:
$C(n, k) = $ the number of k-combinations from an n-set. Or the number of ways to select k elements from an n-set. Or the number of k-subsets of an n-set. Formula: $n!/(k!-(n-k)!)=mat(n;k)$ for $0<=k<=n$
== Pascal's triangle
#align(center, grid(columns: 2, column-gutter: 1em, cetz.canvas({
import cetz.draw: *
let n = 6
// calculate the triangle
let pascal = ()
for row in range(n + 1) {
let row-data = ()
for col in range(row + 1) {
let value = if col == 0 or col == row {
1
} else {
let prev = pascal.at(row - 1)
prev.at(col - 1) + prev.at(col)
}
row-data.push(value)
}
pascal.push(row-data)
}
// draw lines
for (row-idx, row) in pascal.enumerate() {
if row-idx < n {
let row-len = row.len()
let y = n - row-idx
for (col-idx, val) in row.enumerate() {
let x = col-idx - row-len / 2 + 0.5
let next-row-len = row-len + 1
let left-child-x = col-idx - next-row-len / 2 + 0.5
let right-child-x = (col-idx + 1) - next-row-len / 2 + 0.5
let child-y = y - 1
line((x, y / 1.5), (left-child-x, child-y / 1.5), stroke: gray)
line((x, y / 1.5), (right-child-x, child-y / 1.5), stroke: gray)
}
}
}
// draw values
for (row-idx, row) in pascal.enumerate() {
let row-len = row.len()
let y = (n - row-idx) / 1.5
for (col-idx, val) in row.enumerate() {
let x = col-idx - row-len / 2 + 0.5
circle((x, y), radius: 0.25, fill: white, stroke: none, name: "c-" + str(row-idx) + "-" + str(col-idx))
content((x, y), $binom(#str(row-idx), #str(col-idx))$)
}
}
// draw n
for i in range(n + 1) {
content((rel: (-2, 0), to: ("c-" + str(i) + "-0", "-|", "c-" + str(n - 1) + "-0")), [n=#i])
}
}), cetz.canvas({
import cetz.draw: *
let n = 6
// calculate the triangle
let pascal = ()
for row in range(n + 1) {
let row-data = ()
for col in range(row + 1) {
let value = if col == 0 or col == row {
1
} else {
let prev = pascal.at(row - 1)
prev.at(col - 1) + prev.at(col)
}
row-data.push(value)
}
pascal.push(row-data)
}
// draw lines
for (row-idx, row) in pascal.enumerate() {
if row-idx < n {
let row-len = row.len()
let y = n - row-idx
for (col-idx, val) in row.enumerate() {
let x = col-idx - row-len / 2 + 0.5
let next-row-len = row-len + 1
let left-child-x = col-idx - next-row-len / 2 + 0.5
let right-child-x = (col-idx + 1) - next-row-len / 2 + 0.5
let child-y = y - 1
line((x, y / 1.5), (left-child-x, child-y / 1.5), stroke: gray)
line((x, y / 1.5), (right-child-x, child-y / 1.5), stroke: gray)
}
}
}
// draw values
for (row-idx, row) in pascal.enumerate() {
let row-len = row.len()
let y = (n - row-idx) / 1.5
for (col-idx, val) in row.enumerate() {
let x = col-idx - row-len / 2 + 0.5
circle((x, y), radius: 0.25, fill: white, stroke: none, name: "c-" + str(row-idx) + "-" + str(col-idx))
content((x, y), str(val))
}
}
})))
#figure(image("Pascals triangle-2.png"),caption: [Another form of Pascals triangle. It is mirrored])
Binomial identity:
$ mat(n;k) = mat(n;n-k) $
You can do analytic proof (mathematic proof using the formulas) or the combinatorial proof (count it in one way to get first result, then in a different way to get the other result).
*Combinatorial proof for $mat(n;k)=mat(n;n-k)$:* You could say that for n people, you ask k people to walk out the door, or you could ask `n-k` people to stay in the room.
In Pascal's triangle, adding the rows:
$ mat(n;0)+mat(n;1)+mat(n;2)+dots+(n;n)=sum^n_(k=0)mat(n;k)=2^k $
= Binomial identity
For $mat(n;k)$ you can also write $mat(n-1;k)+mat(n-1;k-1)$. It is called Pascal's identity.
#image("pascals identity.png")
= Binomial formula
$ (x+y)¹=x¹+y¹\
(x+y)²=x²+2x y+y²\
(x+y)³=x³ + 3x²y + 3x y³ + y³\
(x+y)=x+4x³y+6x²y²+4x y³+y
$
Note for each $x^(a)y^(b)$, you have $(x+y)^(a+b)$
You also have that the coefficients (for $(x+y)$ you have 1,4,6,4,1) they follow Pascal's triangle
== The formula
$ (x+y)^n&=mat(n;0)x^n+mat(n;1)x^(n-1) y + mat(n;2)x^(n-2)y²+dots+mat(n;n-1)x y^(n-1)+mat(n;n)y^n\
&=sum^n_(k=0) mat(n;k)x^(n-k)y^k $
$ (x+y)^n=sum^n_(k=0)mat(n;k)x^k y^(n-k)$
== Proof by induction with respect to `n`
*Basis step:* Put $n=1$ and prove that the formular is true:
$ (x+y)¹&=mat(1;0)dot x dot y¹ + mat(1;1)dot x¹ dot y\
&=y+x $
*Induction step:* Assume true for `n-1`, then prove that it's then true for `n`:
$ (x+y)^(n-1)=sum^(n-1)_(k=0)mat(n-1;k)x^k y^(n-1-k) $
$
(x+y)^n&=(x+y)dot (x+y)^(n-1) \
&= (x+y)dot sum^(n-1)_(k=0)mat(n-1;k)x^k y^(n-1-k)\
&=sum^(n-1)_(k=0)mat(n-1;k)x^(k+1)y^(n-1-k)+sum^(n-1)_(k=0)mat(n-1;k)x^k y^(n-k)\
&= x^n+ sum^(n-2)_(k=0)mat(n-1;k)x^(k+1)y^(n-1-k) + sum^(n-1)_(k=1)mat(n-1;k)x^k y^(n-k)+y^n\
&"Replace k+1 with k"\
&= x^n+ sum^(n-1)_(k=1)mat(n-1;k-1)x^(k)y^(n-k) + sum^(n-1)_(k=1)mat(n-1;k)x^k y^(n-k)+y^n\
& "Note from pascals identity:" mat(n-1;k-1) + mat(n-1;k) = mat(n;k)\
$
*Combinatorial Proof:*
Consider expanding $(x+y)^n = (x+y)(x+y)dots.c(x+y)$ (n factors).
To get a term $x^(n-k)y^k$, we must:
- Choose $k$ of the $n$ factors to contribute a $y$ (the rest contribute $x$)
- There are $binom(n,k)$ ways to do this
Therefore, the coefficient of $x^(n-k)y^k$ is $binom(n,k)$.
= Van der Mande
$mat(m+n;r)=sum^r_(k=0)mat(m;r-k) mat(n;k)$

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@@ -0,0 +1,103 @@
#title[Inclusion/Exclusion]
Section 8.5+8.6
The hat problem: Suppose everyone one in a classroom has a hat, and they put their hat in a box when they enter, and then grab a random hat when they leave. What is the probability that everybody gets their own hat. Answer is $1/n!$
What about the probability that _someone_ will not get their own hat: $1-1/n!$
What about the probability that someone will get their own hat, or that no one? Need inclusion/exclusion. The probability that no one will get their own hat is $37.8%$ pretty much no matter how many people.
*Remember:*
$|A union B| = |A| + |B| - |A inter B|$
and
$|A union B union C| = |A|+|B|+|C| - |A inter B| - |A inter C| - |B inter C| + |A inter B inter C|$
== Formula
$ |A_1 union A_2 union dots union A_n| = |A_1| + |A_2| + dots + |A_n| - |A_1 inter A_2| - |A_1 inter A_3| - ... - |A_(n-1) inter A_n|\
+ |A_1 inter A_2 inter A_3| + |A_1 inter A_2 inter A_4| + dots + |A_(n-2) inter A_(n-1) inter A_n)|\
- |A_1 inter A_2 inter A_3 inter A_4| - dots - |A_(n-3) inter A_(n-2) inter A_(n-1) inter A_(n)|\
+ |A_1 inter A_2 inter A_3inter A_4 inter A_5| + dots + |A_(n-4) inter A_(n-3) inter A_(n-2) inter A_(n-1) inter A_(n)|\
dots dots (-1)^(n+1) |A_1 inter A_2 inter dots inter A_n| $
$ =sum_(i=1)^n |A_i|- sum_(i<=i_1<i_2<=n) |A_i_1 inter A_i_2| + dots + (-1)^(k+1) sum_(i_1<i_2<dots<i_k)|A_i_1 inter A_i_2 inter dots inter A_i_k| + dots + (-1)^(n+1)|A_1 inter dots inter A_n| $
Proof: Focus on any $x in A_1 union A_2 union dots union A_n$ and see how many times it is counted. Let $k$ be the number of $i$ such that $x in A_i$
$ -mat(k;0) + mat(k;1)-mat(k;2)+mat(k;3)-mat(k;4)+mat(k;5)-dots + (-1)^(k+1) mat(k;k) + 1 = 1 $
(The reason we write $+1$ is because $-mat(k;0)=-1$)
Ignoring the $+1$, the rest is a row in Pascals triangle, and we now the alternating sum (+, then -, then +) is 0, so we know the whole thing will be 1.
Consider a set `A` with `N` elements. Properties $P_1, P_2, P_3, dots, P_n$ which means that some elements have the property and some doesn't. $N(P_3 P_5 P_6 P_9) = $ number of elements with each of the properties $P_3 P_5 P_6 P_9$
$N(P_(3) ' P_(5) ' P_6 ' P_9 ') = $ the number of elements with none of the properties $P_3 P_5 P_6 P_9$
*Inclusion/Exclusion:*
$ N(P_1 'P_2 'dots P_n ') = N - sum^n_(i=1)N(P_i) + sum_(i_1 < i_2)N(P_i_1 P_i_2) dots + (-1)^n N(P_1 P_2 dots P_n) $
*Proof:* Put $A_i=$ the elements with property $P_i$
`m` balls in `n` boxes. We want to count the number of ways to put `m` balls into `n` boxes such that no box is empty. It follows $m>=n$.
$A = $ all functions of $S->B={1,2,3,dots,n}$
$A_i = $ all functions such that `i` is not in the image.
$ |A\\ union_(i=1)^n A_i| = |A|-|union_(i=1)^n A_i| = n^m-mat(n;1)(n-1)^m +mat(n;2)(n-2)^m-dots (-1)^n mat(n;n)(n-n)^m $
= Permutations of an n-set {1,2,3,4}
Normally a permutation of a set is the elements put on a row (like here $2,3,1,4$ and $3,1,4,2$).
You can think of permutations as a bijection (different elements should be mapped to different elements, and every element needs to be mapped to an element) from ${1,2,3,4}$ to ${1,2,3,4}$:
$ mat(1,2,3,4;2,3,1,4) $
Notice the 4, mapped unto itself, it's called a fixed point. The 4's would also be a fixed point here:
$ mat(1,2,4,3;2,3,4,1) $
But then its a different set at the top.
== Derangement
A bijection ($pi$) of a set `S` unto itself with no fixed points.
That is $pi(i) eq.not i$
The hat problem: to find the chances of noone getting their own hat, just use derangements.
== Counting permutations
$A$ is the set of all permutations of ${1,2,dots,n}$
$A_i =$ the set of permutations $pi$ such that $pi(i)=i$
$
D_n &=|A\\(union_(i=1)^n) = |A| - sum_(i=1)^n + sum_(i_1<i_2)|A_i_i inter A_i_2| - dots (-1)^n|A_1 inter A_2 inter dots inter A_n|\
= n! - mat(n;1)(n-1)! + mat(n;2)(n-2)! - &mat(n;3)(n-3)!+dots (-1)^k mat(n;k)(n-k)! plus.minus dots |A_1 inter A_2 inter dots inter A_n|\
&= sum_(k=0)^n (-1)^k mat(n;k)(n-k)!\
&= sum_(k=0)^n (-1)^k n!/(k!(n-k)!) (n-k)!\
&=n! sum_(k=0)^n (-1)^k/k!\
&= k! [1- 1/1! + 1/2! - 1/3! + dots (-1)^n 1/(n!)]
$
$D_n$ is the permutations
$
1&=1/2+1/4+1/8+1/16+1/32+dots\
1&=0.99999999dots\
exp(x)&=1+x/1!+x^2/2!+x^3/3!+dots\
exp(1)&=e=1+1/2!+1/3!+dots\
exp(-1)&=e^-1=1/e=1-1/2!+1/3!-1/4!+dots
$
$exp(-1)$ is what we had before, so
$ D_n &= k! [1- 1/1! + 1/2! - 1/3! + dots (-1)^n 1/(n!)]=n! dot 1/e\
&= n! 1/(2.7dots)= 0.378 n!
$
= Counting primes
The number of primes $<= 100$. The same as saying $100-"not primes"$
Put $ A&={1,2,dots,100}\ A_2 &="The numbers divisible by 2"\ A_3&="The numbers divisible by 3"\ A_5&="The numbers divisible by 5"\ A_7&="The numbers divisible by 7" $
Number of primes
$ &=100-|A_2 union A_3 union A_5 union A_7|-1+4 - |A_2|-|A_3|-|A_5|-|A_7|+|A_2 inter A_3|+dots\
&=103-50-33-20-14+16+14+6+dots=25
$
($-1$ because 1 is not a prime, and $+4$ because else we're excluding $2,3,5,7$)

View File

@@ -0,0 +1,57 @@
Section 8.5: 1, *5*, 9, *11*, *15*, *23*, 27
Section 8.6: 3, *5*, *7*, 13, *21*, *25*
= 8.5-5
Find the number of elements in $A_1 union A_2 union A_3$ if there
are 100 elements in each set and if
1. The sets are pairwise disjoint.
$100+100+100=300$
2. There are 50 common elements in each pair of sets and no elements in all three sets.
$100+100+100-50-50-50=150$
3. There are 50 common elements in each pair of sets and 25 elements in all three sets.
$100+100+100-50-50-50+25=175$
4. The sets are equal.
$100+100+100-100-100-100+100=100$
= 8.5-11
Find the number of positive integers not exceeding 1000 that are not divisible by $3,17, "or" 35$
$1000-333-58-28+19+9+1-17=610$
= 8.5-15
How many bit strings of length eight do not contain six consecutive 0s?
$2^8-12-4-1+7+2=248$
= 8.5-23
Write out the explicit formula given by the principle of inclusionexclusion for the number of elements in the union of six sets when it is known that no three of these sets have a common intersection.
$ |A_1union A_2 union A_3 union A_4 union A_5 union A_6| =\
|A_1|+|A_2|+|A_3|+|A_4|+|A_5|+|A_6|-|A_1 inter A_2| - |A_1 inter A_3| - |A_1 inter A_4| - inter |A_1 inter a_5| - |A_1 inter A_6|\
- |A_2 inter A_3| - |A_2 inter A_4| - |A_2 inter A_5| - |A_2 inter A_6|\
- |A_3 inter A_4| - |A_3 inter A_5| - |A_3 inter A_6| - |A_4 inter A_5| - |A_4 inter A_6| - |A_5 inter A_6|
$
= 8.6-5
Find the number of primes less than 200 using the principle of inclusionexclusion.
$A_n =$ Numbers divisible by `n`
$
"Number of primes" &= 200 - abs(A_2 union A_3 union A_5 union A_7 union A_11 union A_13) - 1 + 6 \
&= 205 - |A_2| - |A_3| - |A_5| - |A_7| - |A_11| - |A_13| \
&quad + |A_2 inter A_3| + |A_2 inter A_5| + ... + |A_11 inter A_13| \
&quad - |A_2 inter A_3 inter A_5| - ... \
&quad + |A_2 inter A_3 inter A_5 inter A_7| + ... \
&quad - |A_2 inter A_3 inter A_5 inter A_7 inter A_11| - ... \
&quad + |A_2 inter A_3 inter A_5 inter A_7 inter A_11 inter A_13| \
&= 205 - 100 - 66 - 40 - 28 - 18 - 15 \
&quad + 33 + 20 + 14 + 9 + 6 + 4 + 2 + 1 + 1 + 1 + 1 + 1 + 1 \
&quad - 6 - 4 - 2 - 2 - 1 - 1 - 1 - 1 - 1 - 1 \
&quad + 1 + 1 + 1 + 1 + 1 \
&quad - 0 - 0 - 0 - 0 \
&quad + 0 \
&= 46
$
= 8.6-7
How many positive integers less than 10,000 are not the second or higher power of an integer?
= 8.6-21

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

View File

@@ -0,0 +1,60 @@
#image("Opgaver-numre.png")
= Opgave 1.7-3
#image("opgave3-1.7.png")
For an even number you know that $a=2k$.
Thus you can say $a²=(2k)²=4k²=2(2k²)$
Now you have $2(2k²)$ which is the same form as the formula for an even number, thus it's proven.
= Opgave 1.7-11
#image("opgave11.png")
If you for example take the irrational number $sqrt(2)$. The product of that is $sqrt(2)²=2$. This disproves that the product of two irrational numbers are irrational.
= Opgave 1.7-37
#image("opgave37.png")
Because there is not a biimplification between step 1 and 2. When you take the square root of something, you can't nescecarily go back, because you have to go back to a $plus.minus$. You can prove this by x=6. For step 2, this is a correct x to solve the equation, but not for step 1. When you have $sqrt(x+3)$, and you take the square too, you have $(plus.minus sqrt(x+3))²$.
= Opgave 1.7-41
#image("opgave41.png")
The equal to is easy to prove. If you have only 1 number or take the average of $a_n$ of same value, the average will then be the same value.
To prove the theory, you can say the opposite, which is that all the values of a is less than the sum.
This is provably false. The equation to get the average is $A=(a_1+a_2+a_3+...+a_n)/n$. We can get this from it: $A*n=a_1+a_2+a_3+...+a_n$.
If we say that all numbers of _a_ is less than the average, then all of them added together must be less than the average times the amount of elements: $a_1+a_2+a_3+...+a_n<A*n$
Now we have a contradiction. We know that when you prove the opposite, then the original must be true, and thust the statement is true.
I used proof by contradiction
= Opgave 2.1-11
#image("opgave-2.1-11.png")
a) False. Empty set has no elements
b) False. Only an empty set contains nothing
c) False. No elements in empty set
d) True. An empty subset is a subset of everything.
e) False.
f) False. True {0} is a subset of {0}, but they are equal to each other, so its false
g) True.
= Opgave 2.1-21
#image("Opgave 2.1-21.png")
a) 1 (contains 1 element)
b) 1 (contains 1 element: a list of another element)
c) 2 (contains 2 elements: a and a list)
d) 3 (contains 3 elements: a, and 2 lists)
= Opgave 2.1-27
#image("opgave 2.1-27.png")
For $cal(P)(A)$ to be a subset of $cal(P)(B)$, then A must have been a subset of B to begin with. If A is a subset of B, then the elements of the powerset of A must be contained in the powerset of B (alongside many more). If A was not a subset of B (containing an element not in B), then its powerset would also have elements not in the powerset of B and thus not be a subset.
= Opgave 2.1-37
#image("Opgave 2.1-37.png")
Its size would be $|A|*|B|$. When you calculate $A times B$ you calculate every "variation" of the elements of both, so for $a_1$ you pair it with every element of B until $a_n$. Thus it's their lengths times eachother

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,195 @@
= Propositional and predictive logic
= Proofs
Argument that something is true, foolproof, objective, argument.
== Direct proof
Want to prove $p->q$
Assume p, then through several steps of reasoning, conclude q.
*Eks:*
If $n$ is odd, then $n²$ is odd
Def: An integer n is #underline[even] if $exists k in ZZ, s.t., n=2k$
n is odd if $exists in ZZ #text("such that") n=2k+1$
Assume n is odd. then $exists k in ZZ #text("such that") n=2k+1$
So
$
n²=(2k+1)²=4k²+4k+1\ \
=2(2k²+2k)+1
$
Since $k in ZZ$, then $2k²+2k in ZZ$, so $n²$ is odd.
== Proof by contraposition
Prove $p->q$ by proving $not p-> not q$
For an integer n, if is odd, then n is odd.
Suppose is odd, then $exists k in ZZ #text("such that") n²=2k+1$
So $n=plus.minus sqrt(2k+1)$
We prove that if n is even, then is even.
Suppose n is even, then $exists in ZZ #text("such that") n=2k$
So $n²=(2k²)=4k²=2(2k²)$
Since $2k²$ is an integer, is even.
== Proof by contradiction
Want to prove _p_ by assuming it's not true (assume $not p$) and then reach a contradiction.
By contradiction we are going to conclude something we know is false.
Showing: $not p->p$
*Eks:*
$sqrt(2)$ is irrational
A real number r is #underline[rational] if $exists a,b in ZZ$ #underline[with] $b eq.not 0 space #text("such that") space r=a/b$
Assume $sqrt(2)$ is rational. Then $exists a, b in ZZ, b eq.not 0 space #text("such that") space sqrt(2)=a/b$. You can assume that a and b have no common factors.
Then:
$
2=(a²)/(b²) \
2b²=a²
$
So is even, therefore a is even, then:
$ exists k in ZZ, a=2k $
$
2b²=(2k²)=4k²=> \
b²=2k²
$
So is even and therefore b is even.
Now that we've shown that a and b have a common factor (they have a common factor, 2, because both are even).
So now we have shown that $sqrt(2)$ can't be a rational number because there then is a contradiction.
= Sets
Def: A #underline[set] is an unordered collection of objects called #underline[elements]/#underline[members] of the set. We a set contains its elements.
$a in A$ - a is an element of A
$ a in.not A$ - a is NOT an element of A
It's also called the naive set theory, which leads to some paradoxes (Russell's Paradox, exercise 50 in 2.1 in book).
A way to describe a set, is to list all its elements. Eks: $A= {1,2,3,4}, B = {a,b,c,d}, C={"Apple",7,"Mike","Tivoli"}$
You can also do: ${x|"x has property P"}$
Ex:
$ O&={x|x" is an odd integer"} \
&={x in ZZ|x "is odd"}
$
A set can have sets as elements. A set does not contain it's subelements if it contains sets. ${NN, ZZ, QQ, RR}$ does e.q. not contain the number 2. It contains sets that contain the number 2, but it itself does not.
== Important sets
$NN={0,1,2,3,4,...}$ - Set of natural numbers (some argue 0 is not in the natural numbers, some argue it is).
$ZZ={...,-2,-1,0,1,2,...}$ - Set of Integers. Can say $ZZ$ or $ZZ_(>=0)$ for integers greater than 0.
$QQ = {a/b|a,b in ZZ, b eq.not 0}$ - Set of rational numbers
$RR$ - Real numbers (all numbers)
$CC$ - Complex numbers
== When two sets are equal
Def: Two sets A and B are equal if and only if they contain exactly the same elements.
$A=B$ if and only if $forall x{x in A <-> x in B}$
Order and amount of appearances doesn't matter in sets, so $ {1,3,5}={5,3,1}={1,3,3,5,5,5} $
If you have a set of variables, and some of them are equal, their value still only appears once.
== Empty set
This is the set with no elements. Notation $emptyset$
== Singleton set
Set with one element
== Subset
Def: A is a #underline[subset] of B, and B is a #underline[superset] of A, if and only if, every element of A is an element of B. Denoted $A subset.eq B$ or $B supset.eq A$.
You should say "A is a subset of B"
To show $A subset.eq B$: show that $"if" x in A ", then" x in B$. Show that every element in A is in B
To show $A subset.eq.not B$: find $"some" x in A "such that" x in B$. Find an element in A that is not in B.
*Theorem:* For any set S, $emptyset subset.eq S$ and $S subset.eq S$
$forall x(x in nothing -> x in S)$ is true ($x in nothing$ will always be false, so that means the implication is always true).
== Size of set (cardinality)
Def: Let S be the set. If there are exactly n distinct elements in S where $n in NN$, then we say that S is a finite set, with cardinality (size) n. $|S|=n$.
$
A&={x in ZZ|"x is odd and" x <=10} \
|A|&=5\
|nothing|&=0
$
A set is infinite if it's not finite ($NN, RR, ZZ, QQ$ are for example all infinite).
== Powerset
Def: Let S be a set, the #underline[powerset] of S, denoted $cal(P)(S)$, is the set of all subsets of S
$cal(P)({0,1,2,3})={nothing,{0},{1},{2},{3},{0,1},{0,2}{1,2},{0,1,2,3}}$
$|S|=n , |cal(P)(S)|=2^n$
$cal(P)(nothing)={nothing}$
== Cartesian products
Def: The (ordered) n-tuple $(a_1,a_2,...,a_n)$ is the ordered collection that has $a_i$ as its i'th element.
$(a_1,a_2,...,a_n)=(b_1,b_2,...,b_n) "if and only if" a_i=b_i forall i=1,2,...,n$ (n-tuples are equal if and only if their elements are the same and in the same order)
2-tuples are called ordered pairs
$(a,b) != (b,a)$ (unless $a=b$)
*Def:* Let A and B be sets. The cartesian product of A and B, denoted $A times B$, is the set of all ordered pairs (a,b) where $a in A$ and $b in B$
$A times B={(a,b)|a in A and b in B}$
Ex: $A={1,2}, B={a,b,c}$
$ A times B={(1,a), (1,b), (1,c), (2,a), (2,b), (2,c)} $
$A times B != B times A$ (unless $A=B$ or $A=nothing or B=nothing$)
=== Cartesian product of many sets
Def: The Cartesian product of $A_1,A_2,...,A_n$, denoted by $A_1 times A_2 times ... times A_n$ is the set of n-tuples ($a_i,a_2,...,a_n$) such that $a_i in A_i "for all" i=1,2,...,n$
*NOTE:* $A times (B times C) !=(A times B)times C !=A times B times C$
First one would be $((a,b),c)$, second one would be $(a,(b,c))$, third would be $(a,b,c)$.
$A²=A times A,space A³=A times A times A$, etc.
== Relations
A subset R of $A times B$ is called a relation from A to B.
A relation from A to itself is called a relation on A.
*Example*
$A={0,1,2,3}$
$
R&={(a,b)|a,b in A and a <=b} \
&={(0,0),(0,1),(0,2),(0,3),(1,1),(1,2),(1,3),(2,2),(2,3),(3,3)}
$

View File

@@ -0,0 +1,118 @@
= Opgaver
#image("Opgaverne.png")
== Opgave 1.1-1
#image("Opgave-1.1-1.png")
a) Proposition. And it is true
b) Proposition. And it is false.
c) Proposition. True
d) Proposition. False
e) Not a proposition because it has a variable.
f) Not a proposition because it is a command.
== Opgave 1.1-3
#image("Opgave 1.1-3.png")
a) Linda is not younger (older or same age) than Sanjay
b) Mei does not make more money than Isabella (makes less or same)
c) Moshe is not taller than Monica (shorter or same age)
d) Abby is not richer than Ricardo
== Opgave 1.1-11
#image("Opgave-1.1-11.png")
a) Sharks have not been spotted near the shore.
b) Swimming at the New Jersey shore is allowed and sharks have been spotted near the shore.
c) Either swimming is not allowed at the New Jersey shore or sharks have been spotted near the shore.
d) Swimming is allowed at the shore which implies sharks have not been spotted.
e) Sharks have not been spotted at the shore which implies it is allowed to swim there.
f) Swimming is not allowed at the shore which implies sharks have not been spotted.
g) Swimming is allowed at the shore if and only if sharks have not been spotted.
h) Swimming is allowed or sharks have not been spotted and swimming is not allowed.
== Opgave 1.1-37
#image("Opgave 1.1-37.png")
#table(columns: 10)[p][q][$not p$][$not q$][$p->not q$][$not p <->q$][$(p->q)or(not p->q)$][$(p->q)and(not p-> q)$][$(p<->q)or(not p<->q)$][$(not p <-> not q)<->(p<->q)$][T][T][F][F][F][F][T][T][T][T][F][T][T][F][T][T][T][T][T][T][T][F][F][T][T][T][T][F][T][T][F][F][T][T][T][F][T][F][T][T]
== Opgave 1.1-53
#image("Opgave 1.1-53.png")
a) Only the 99th statement would be true. For example the 3rd statement cant be true because if only 3 of the statements are false, that would mean the other 97 statements are true, but they cant be because they say other amounts of statements are false. But for the 99th, it would be true that all the other statements are false except for that one. The 100th statement cant be true because if all statements in the list are false, then the 100th would be true, which it cant be if all are false.
b) Only the statements of $n<=50$ would could be true, because for the 51th statement "At least 51 of the statements are false" it is incorrect that _at least_ 51 of the statements are false (statements 1-50 are also true, so there's only 49 remaining false statements which is contradicting the statement).
c) It would mean that statements 1-49 would be true as for the 49th statement, at least 49 of the statements _are true_ (real answer is 50 but 50 is at least 49).
== Opgave 1.4-1
#image("Opgave 1.4-1.png")
a) $P(0)=T$
b) $P(4)=T$
c) $P(6)=F$
== Opgave 1.4-31
#image("Opgave 1.4-31.png")
a) $forall y Q(0,0,0) and forall y Q(0,1,0)$
b) $exists x Q(0,1,1) or exists x Q(1,1,1) or exists x Q(2,1,1)$
c) $exists z not Q(0,0,0) or exists z not Q(0,0,1)$
d) $exists x not Q(0,0,1) or exists x not Q(1,0,1) or exists x not Q(2,0,1)$
== Opgave 1.4-35
#image("Opgave 1.4-35.png")
a) $exists x(x<=1)$
b) $exists x(x>2)$
c) $forall x(x<4)$
d) $forall x(x>=0)$
e) $exists x((x>=-1) and (x<=2))$
f) $forall x((x>=4) and (x<=7))$
== Opgave 1.4-37
#image("Opgave 1.4-37.png")
a) No counterexample, it would only be happen for numbers between 0 and 1 (0.1,0.2,...0.9)
b) $exists x(x=0)$
c) $exists x(x>1or x<1)$
== Opgave 1.4-41
#image("Opgave 1.4-41.png")
a) If there exists a printer that is out of service and is also busy, that leads to some work being lost.
b) If all printers are busy, then a job is in the queue
c) If there exists a print job that gets queued but also lost, then a printer is out of service
d) If all printers are busy and all print jobs are queued, a print job has been lost
== Opgave 1.4-55
#image("Opgave 1.4-55.png")
a) Truth
b) False
c) True

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,97 @@
#import "@preview/cetz:0.4.0"
#import "@preview/cetz-venn:0.1.4"
#image("Opgaver 18-09-25-image.png")
#image("Opgave 2.2-27.png")
a) ${4,6}$
b) ${0,1,2,3,4,5,6,7,8,9,10}$
c) ${4,5,6,7,8,10}$
d) ${0,2,4,5,6,7,8,9,10}$
#image("opgave 2.2-29.png")
#cetz.canvas({
cetz-venn.venn3(
name: "venn1",
ab-fill: blue.lighten(60%),
stroke: black + 1pt
)
import cetz.draw: *
content("venn1.a", [A], size: 14pt)
content("venn1.b", [B], size: 14pt)
content("venn1.c", [C], size: 14pt)
content((0, -3), [$A inter (B - C)$: Only the AB region (excluding ABC)], size: 12pt)
})
#cetz.canvas({
cetz-venn.venn3(
name: "venn2",
ab-fill: green.lighten(60%),
ac-fill: green.lighten(60%),
abc-fill: green.lighten(40%),
stroke: black + 1pt
)
import cetz.draw: *
content("venn2.a", [A], size: 14pt)
content("venn2.b", [B], size: 14pt)
content("venn2.c", [C], size: 14pt)
content((0, -3), [$(A inter B) union (A inter C)$: All regions where A overlaps with B or C], size: 12pt)
})
#cetz.canvas({
cetz-venn.venn3(
name: "venn3",
a-fill: orange.lighten(60%),
ab-fill: orange.lighten(50%),
ac-fill: orange.lighten(50%),
abc-fill: orange.lighten(40%),
stroke: black + 1pt
)
import cetz.draw: *
content("venn3.a", [A], size: 14pt)
content("venn3.b", [B], size: 14pt)
content("venn3.c", [C], size: 14pt)
content((0, -3), [$(A union B) inter (A union C) = A union (B inter C)$ (distributive law)], size: 12pt)
})
#image("Opgave 2.2-35.png")
We can use De morgans laws, which states: $dash(A union B)= dash(A) inter dash(B)$. We use that on the 3 parentheses.
$
dash((A union B)) inter dash((B union C)) inter dash((A union C))<=>\
(dash(A)inter dash(B)) inter (dash(B) inter dash(C)) inter (dash(A) inter dash(C)) <=> \
"We know because of the distributive laws, that in our case, the parenthases dont matter, so:"\
dash(A) inter dash(B) inter dash(B) inter dash(C) inter dash(A) inter dash(C) <=> \
"We can remove dupplicates:"\
dash(A)inter dash(B) inter dash(C)
$
#image("Opgave 2.2-47-prerequisits.png")
#image("Opgave 2.2-47.png")
Yes. If A contained an element that B did not, it would mean $A plus.circle B$ now contains elements not in $B plus.circle C$ because A has an extra element not in C, so it is in $A plus.circle C$, but since B does not contain it, it is not in $B plus.circle C$. A and B must also contain the same elements of C, since if they did not, no matter what $A plus.circle C = B plus.circle C$ would not be true.
#image("opgave 2.3-9g.png")
$floor(1/2+ceil(3/2))<=>\ floor(1/2+2)=floor(2.5)=2$
#image("opgave 2.3-21.png")
a) $f(x)=2|x|+x$ - It will always be a positive even integer minus x.
b) $f(x)=|x|$ - All positive integers are mapped to an integer, but they are all mapped to two.
c) $underbracket(f\: ZZ arrow ZZ^+, f(x) = cases(2x "if" x > 0, -2x + 1 "if" x <= 0))$
d) $f(x)=x^2$
#image("opgave 2.3-27.png")
a) For a strictly decreasing function we know: $x>y=>f(x)>f(y) space forall x,y in A$, which means that two for two different x and y, f(x) and f(y) must be different.
b) $f(x)=cases(x "if" x>=0,-1 "if" x<=0)$
#image("opgave 2.3-73.png")
#image("opgave 2.3-73a.png")
If one of $f_(A)(x) "or" f_(B)(x)$ is 0, then $f_(A inter B)(x)$ must be 0 because of the $inter$. $f_(A)(x) dot f_(B)(x)$ must also be 0 because then you are multiplying with 0, which will always be 0.

View File

@@ -0,0 +1,169 @@
=== Union of 2 sets
Def: Let A and B be sets. The Union of A and B, denoted by $A union B$, is the set that contains every element in either A or B or both.
$ A union B={x|x in A or x in B} $
The order of the operation doesn't matter
#image("union-of-a-and-b.png", width: 50%)
=== Intersections
Def: Let A and B be sets. The intersection of A and B, denoted by $A inter B$, is the set containing those elements, that are in both A and B.
$ A inter B = {x|x in A and x in B} $
The order of the operation doesn't matter
#image("intersection.png",width: 50%)
=== Disjoint
Def. A and B are disjoint if $A inter B =nothing$, aka they don't have any elements in common.
=== Size of elements in two sets
If A and B are finite sets, then: $ |A union B| = |A| + |B| - |A inter B| $
To get size of the elements in the sets, you need to add their size together, and then subtract all the elements they have in common.
=== Difference
Def: Let A and B be sets. The Difference of A and B, denoted $A-B$, is the set containing those elements of A that are not in B. $ A-B={x|x in A and x in.not B} $
Sometimes also denoted $A\\B$
#image("difference-a-b.png",width: 50%)
If $A-B=nothing$. Either $A=B$ or $A subset B$ (A is a subset of B).
=== Complement
Everything that is not in the set. But you need a universal set (in the pictures, the rectangle is the universal set).
Def: Let U be the universal set. The complement of the set A, denoted by $macron(A)$, is the containing all the elements of U that are not in A. $macron(A)=U-A$
#image("complement.png",width: 50%)
Example.
$
U=NN,space space space A&={1,3,5,7,...}\
dash(A)&={0,2,4,6,...}\
U=ZZ, space space space dash(A)&={...,-2,-1,0,2,4,...}
$
=== Set identities
#image("set-identities.png",width: 75%)
Prove: $dash(A union B) = dash(A) union dash(B)$
$ x in dash(A union B) <=>\
x in.not A union B <=> \
x in.not A and x in.not B <=>\
x in dash(A) and x in dash(B) <=> \
x in dash(A) union dash(B) $
If x is in the complement of the union of A and B, then it must not be in the union of A and B. In other words, it is not in either A or B. This can be written as x being in the complement of A and the complement of B. This can be then be written as x is in the union of the complement of A and the complement of B.
Prove: $dash(A union (B inter C))=(dash(C) union dash(B)) inter dash(A)$
$
dash(A union (B inter C)) <=>\
dash(A) inter (dash(B union C)) <=>\
dash(A) inter (dash(B) union dash(C))
$
== Unions and intersections of an arbitrary number of sets
$union_(i=1)^(arrow.ccw.half)A_i={x|exists space i in {1,dots,b} text("such that") x in A_i}$
$inter_(i=1)^(arrow.ccw.half)A_i={x|forall space i in {1,dots,n} text("such that") x in A_i}$
$union_(i=1)^(infinity)A_i={x|exists space i in ZZ^+ text("such that") x in A_i}$
$inter_(i=1)^(infinity)A_i={x|forall space i in ZZ^+ text("such that") x in A_i}$
Example:
$A_i={1,2,3,dots,i}, A_1={1}, A_2={1,2}$
$union^(infinity)_(i=1)A_i=ZZ^+, inter_(i=1)^(infinity)A_i={1}$
= Functions
Def: Let A and B be nonempty sets. A function _f_ from A to B is an assignment of exactly one element of B to each element of A. We write $f(a)=b$ if b is the element of B that _f_ assigns to _a_.
We write $f: A->B$ to denote that _f_ is a function from A to B.
$(a,f(a))in A times B$
Def: Let $f:A->B$
*Domain* of _f_ is A
*Codomain* of _f_ is B
If $f(a)=b$, then b is the *image* of _a_ under _f_, and _a_ is a *preimage* of _b_. For every _a_ it matches a single _b_.
*Range/Image* of _f_ the set of all images
Example: $A={a,b,c,d}, space B={1,2,3,4}, space f:A->B$
$f(a)=1,space f(b)=2,space f(c)=3,space f(d)=4$
*Real-valued function* means that $text("codomain")=RR$ (real number)
*Integer-valued function* means that $text("codomain")=ZZ$ (integers)
== Sum
Def: let $f_1 text("and") f_2$ be realvalued functions from A, then $f_1+f_2 text("and") f_1f_2$ are functions from A to $RR$ defined as: $ (f_1+f_2)(x)=f_1(x)+f_2(x)\ f_1f_2(x)=f_1(x)f_2(x) $
*Example:*
$f_1,f_2:RR->RR space f_1(x)=x^2, space f_2(x)=x-x^2$
$ (f_1+f_2)(x)=x\ f_1f_2(x)=x^3-x^4 $
*Def:* Let $f:A->B$. IF $S subset.eq A$, then the image of S under f, denoted $f(S)$ is the set ${b in B|exists a in S text("such that") f(a)=b}$
Example: $f:RR->RR space f(x)=x^2$
$S={-1,0,1}\ f(S)={0,1}$
== Injectivity and Surjectivity
#image("Different correspondence.png")
=== Injectivity
Def: A function $f:A->B$ is one-to-one/injective/an injection if $f(x)=f(y)=>x=y, forall x,y in A$. Two elements in the domain, cannot match to the same element in the codomain.
$x!=y=>f(x)=>f(y)$.
*Example*
$f:ZZ->ZZ space f(x)=x^2$
This is not injective as for example both -1 and 1 give the same answer.
$f:NN->ZZ space f(x)=x^2$ would be injective as you now only have positive x.
~
*Def:* Let $f:A->B text("such that") A,B subset.eq RR$. Then _f_ is increasing if $x<=y=>f(x)<=f(y) space forall x,y in A$.
It would be strictly increasing if $x<y=>f(x)<f(y) space forall x,y in A$. And this would be the same for decreasing, only the opposite of course.
A strictly increasing function implies that the function is injective
=== Surjectivity
Def: A function $f:A->B$ is surjective/onto/a surjection if $forall b in B, exists a in A "such that" f(a)=b$. For every element in the codomain, there exists an element in the domain that matches to it.
Example: $f:ZZ->ZZ space f(x)=x-1$
Let $k in ZZ, "then" k+1 in ZZ "and" f(k+1)=k+1-1=k$.
$f:NN->NN space f(x)=2x$ would not be surjective because the uneven numbers in the codomain would not have an element in the domain matched to them. $f:ZZ->ZZ space f(x)=2x$ would be surjective because for every real number, half that number would still be a real number, so every element in the codomain would have an element in the domain that matches it.
=== Bijection
Def: A function is a bijection/one-to-one correspondence if it is both injective and surjective
Suppose $f:A->B$
To show that f is _injective_: show if $f(x)=f(y), "then" x=y space("for arbitrary" x,y in A)$
To show that it's not _injective_: Find a particular $x,y in A "such that" x!=y "and" f(x)=f(y)$
To show that f is _surjective_: Consider arbitrary $b in B, "and show" exists a in A "such that" f(a)=b$
To show that it's not _surjective_: Find a particular $b in B "such that" exists.not a in A "with" f(a)=b$
== Inverse
Def: Let $f:A->B$ be a bijection. The inverse function of _f_, denoted $f^(-1)$, is the function from B to A that assigns to $b in B$ the unique element $a in A "such that" f(a)=b$. Note: $f^(-1)!=1/f$.
== Composition
Let $f:A->B, space g:B->C$
$ g compose f: A->C\ f compose g(a)=g(f(a)) $
=== Floor function
Largest integer that is less than or equal to x
=== Ceiling function
Smallest integer that is greater than or equal to x

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB