college/Fall-2024/CS-3333/Assignments/4/Assignment.typ

398 lines
9.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#show link: set text(blue)
#set text(font: "Calibri")
#show raw: set text(font: "Fira Code")
#set table.cell(breakable: false)
#set table(stroke: (x, y) => (
left: if x > 0 {
.1pt
},
top: if y == 1 {
0.5pt
} else if y > 1 {
0.1pt
},
))
#set math.mat(delim: "[")
#set page(margin: (x: .5in, y: .5in))
#let solve(solution) = {
block(
inset: 10pt,
stroke: blue + .3pt,
fill: rgb(0, 149, 255, 15%),
radius: 4pt,
)[#solution]
}
#let solvein(solution) = {
let outset = 3pt
h(outset)
box(
outset: outset,
stroke: blue + .3pt,
fill: rgb(0, 149, 255, 15%),
radius: 4pt,
)[#solution]
}
#let note(content) = {
block(
outset: 5pt,
inset: 10pt,
stroke: luma(20%) + .3pt,
fill: luma(95%),
radius: 4pt,
)[#content]
}
#let notein(content) = {
let outset = 3pt
h(outset)
box(
outset: outset,
stroke: luma(20%) + .3pt,
fill: luma(95%),
radius: 4pt,
)[#content]
}
#align(center)[
= CS 3333 Mathematical Foundations
Homework 4 (100 points)\
#underline[Price Hiller] | #underline[zfp106]
]
#line(length: 100%, stroke: .25pt)
*Submission:*\
Same as HW1.
*Questions*\
Please write down the major intermediate steps.
1. Calculate the sum of two matrices if it is defined. (10 pts)
#enum(
numbering: "(a)",
tight: false,
number-align: start + top,
[
(5 pts)
$mat(
5, 7, -2;
6, 0, 5;
0, 4, 1;
) + mat(
3, 0, 4;
-5, -6, 8;
7, 9, 0
) =$
#note[
$mat(
5, 7, -2;
6, 0, 5;
0, 4, 1;
) + mat(
3, 0, 4;
-5, -6, 8;
7, 9, 0
) &= mat(5 + 3, 7 + 0, 4 + (-2);6 + (-5), 0 + (-6), 5 + 8; 0 + 7, 4 + 9, 1 + 0;)\
&= #solve[$mat(8, 7, 2; 1, -6, 13; 7, 13, 1;)$]$
]
],
[
(5 pts)
$mat(
2, 0, 7;
9, 5, 6;
8, 4, 0;
) + mat(
6, 1;
4, 7;
0, 5;
) =$
#solve[The addition is *not defined*. The first matrix is of order $3×3$ whereas the order of the second matrix is of order $3×2$.]
],
)
2. Calculate $A*B$ if it is defined. (25 pts)\
#enum(
numbering: "(a)",
tight: false,
number-align: start + top,
[
(5 pts) $A = 8$, $B = mat(
7, 0, -2, 4;
-6, 1, -3, 5;
)$
#note[$
"AB" &= 8 mat(
7, 0, -2, 4;
-6, 1, -3, 5;
)\
"AB" &= mat(
8 ⋅ 7, 8 ⋅ 0, 8 ⋅ -2, 8 ⋅ 4;
8 ⋅ -6, 8 ⋅ 1, 8 ⋅ -3, 8 ⋅ 5;
)\
"AB" &= #solve[$mat(
56&, 0&, -16&, 32&;
-48&, 8&, -24&, 40&;
)$]
$]
],
[
(10 pts) $A = mat(7, 0, -2, 4; -6, 1, -3, 5;)$ $B = mat(-1, 6; -4, 4; 5, 8; 0, -7;)$
#note[
$
"AB" &= mat(7, 0, -2, 4; -6, 1, -3, 5;) × mat(-1, 6; -4, 4; 5, 8; 0, -7;)\
"AB" &= mat(
((7 * -1) + (0 * -4) + (-2 * 5) + (4 * 0)), ((7 * 6) + (0 * 4) + (-2 * 8) + (4 * -7));
((-6 * -1) + (1 * -4) + (-3 * 5) + (5 * 0)), ((-6 * 6) + (1 * 4) + (-3 * 8) + (5 * -7));
)\
"AB" &= #solve[$mat(
-17&, -2&;
-13&, -91&;
)$]
$
]
],
[
(10 pts) $A = mat(1, 0, 0; 0, -1, -1; -1, 1, 0;)$ $B = mat(1, 1, -1; 0, -1, 1; 1, 1, 0;)$
#note[
$
"AB" &= mat(1, 0, 0; 0, -1, -1; -1, 1, 0;) × mat(1, 1, -1; 0, -1, 1; 1, 1, 0;)\
"AB" &= mat(
((1 * 1) + (0 * 0) + (0 * 1)), ((1 * 1) + (0 * -1) + (0 * 1)), ((1 * -1) + (0 * 1) + (0 * 0));
((0 * 1) + (-1 * 0) + (-1 * 1)), ((0 * 1) + (-1 * -1) + (-1 * 1)), ((0 * -1) + (-1 * 1) + (-1 * 0));
((-1 * 1) + (1 * 0) + (0 * 1)), ((-1 * 1) + (1 * -1) + (0 * 1)), ((-1 * -1) + (1 * 1) + (0 * 0))
)\
"AB" &= #solve[$mat(
1&, 1&, -1&;
-1, 0&, -1&;
-1, -2&, 2&
)$]\
$
]
],
)
3. Compute $"AB"$ and $"BA"$. Does $"AB" = "BA"$? (10 pts)
$A = mat(2, 2; 2, 1;)$ and $B = mat(1, 2; 1, 2;)$
#note[
$
"AB" &= mat(2, 2; 2, 1;) × mat(1, 2; 1, 2;)\
"AB" &= mat(((2 * 1) + (2 * 1)), ((2 * 2) + (2 * 2)); ((2 * 1) + (1 * 1)), ((2 * 2) + (1 * 2));)\
"AB" &= #solve[$mat(4, 8; 3, 6;)$]\
$
#align(center)[#line(length: 6cm)]
$
"BA" &= mat(1, 2; 1, 2;) × mat(2, 2; 2, 1;) \
"BA" &= mat(((1 * 2) + (2 * 2)), ((1 * 2) + (2 * 1)); ((1 * 2) + (2 * 2)), ((1 * 2) + (2 * 1));)\
"BA" &= #solve[$mat(6, 4; 6, 4;)$]\
$
#solve[$"AB" ≠ "BA"$]
]
4. Compute the transpose of matrix A (5 pts)
$A = mat(9, 2, 5; 1, 0, 4;)$
#solve[
$
A^t &= mat(9, 1; 2, 0; 5, 4)
$
]
#align(center)[#text(size: 2em)[#note[See next page]]]
5. #block(breakable: false)[Represent the following system of linear equations using matrices
$
a_11x_1 + a_12x_2 + a_13x_3 + a_14x_4 &= b_1\
a_21x_1 + a_22x_2 + a_23x_3 + a_24x_4 &= b_2\
a_31x_1 + a_32x_2 + a_33x_3 + a_34x_4 &= b_3\
a_41x_1 + a_42x_2 + a_43x_3 + a_44x_4 &= b_4
$
The representation is $A*X = B$. What is matrices $A$, $X$, and $B$? (10 pts)
#align(center)[
#solve[
#table(
stroke: (x, y) => (
left: none,
top: if y > 0 {
.5pt
},
),
columns: (auto, auto, auto, auto, auto),
align: center + horizon,
table.header([$A$], [], [$X$], [], [$B$]),
[
$
mat(
delim: "(",
a_11, a_12, a_13, a_14;
a_21, a_22, a_23, a_24;
a_31, a_32, a_33, a_34;
a_41, a_42, a_43, a_44;
)
$
],
[$⋅$],
[
$
mat(delim: "(",
x_1;
x_2;
x_3;
x_4;
)
$
],
[$=$],
[
$
mat(delim: "(",
b_1;
b_2;
b_3;
b_4;
)
$
],
)
]
]
]
6. Show the adjacency matrix for the following graph. (20 pts)
#figure(
image("./assets/graph.png", width: 60%),
) <fig-graph>
#align(center)[
#solve[
#table(
stroke: (x, y) => (
left: if y > 0 {
if x == 1 {
0.5pt
} else if x > 1 {
.1pt
}
},
top: if x > 0 {
if y == 1 {
0.5pt
} else if y > 1 {
.1pt
}
},
),
columns: (auto, auto, auto, auto, auto, auto, auto),
fill: (x, y) => {
if calc.odd(y) and y > 0 and x > 0 {
color.hsl(200deg, 60%, 40%, 25%)
} else {
none
}
},
inset: 3pt,
[ ], [A], [B], [C], [D], [E], [F],
[A], [1], [1], [0], [0], [1], [0],
[B], [1], [1], [1], [1], [1], [0],
[C], [0], [1], [1], [0], [1], [1],
[D], [0], [1], [0], [1], [1], [0],
[E], [1], [1], [1], [1], [1], [0],
[F], [0], [0], [1], [0], [0], [1],
)
#notein[
Sorry about the lack of _proper_ matrix notation. I had a hard time typesetting the row and column labels for matrices in particular in Typst :(. I have to wait on https://github.com/typst/typst/issues/445 to get resolved I guess.
#text(size: .9em)[_Arguably though, that table _is_ easier to read._]
]
]
]
#align(center)[#text(size: 2em)[#note[See next page]]]
7. #block(breakable: false)[Compute the determinant of matrix $A$. (20 pts)
$
A = mat(
6, 1, 4, 8;
4, 2, 3, 2;
4, 1, 2, 3;
9, 7, 5, 6;
)
$
#align(center)[
#note[
#align(left)[#note[
$|A| = 6mat(
2, 3, 2;
1, 2, 3;
7, 5, 6;
) - 1mat(
4, 3, 2;
4, 2, 3;
9, 5, 6;
) + 4mat(
4, 2, 2;
4, 1, 3;
9, 7, 6;
) - 8mat(
4, 2, 3;
4, 1, 2;
9, 7, 5;
)$
]]
#align(left)[#note[
#notein[The expanded values were found via *Sarrus' rule* for each $3 × 3$ matrix above.]
$
|A| &=\
6&[
(2 * 2 * 6) + (3 * 3 * 7) + (2 * 1 * 5) - (7 * 2 * 2) - (
5 * 3 * 2
) - (6 * 1 * 3)
]\
- 1&[
(4 * 2 * 6) + (3 * 3 * 9) + (2 * 4 * 5) - (9 * 2 * 2) - (
5 * 3 * 4
) - (6 * 4 * 3)
]\
+ 4&[
(4 * 1 * 6) + (2 * 3 * 9) + (2 * 4 * 7) - (9 * 1 * 2) - (
7 * 3 * 4
) - (6 * 4 * 2)
]\
- 8&[
(4 * 1 * 5) + (2 * 2 * 9) + (3 * 4 * 7) - (9 * 1 * 3) - (
7 * 2 * 4
) - (5 * 4 * 2)
]\
$
]]
#align(left)[#note[
$
|A| &=
6[21]
- 1[1]
+ 4[-16]
- 8[17]\
$
]
]
#align(center)[#solve[-75]]
]
]
]