ROB 101 - Computational Linear Algebra
HW #1
Profs Grizzle and Ghaffari
Due 9 PM = 21:00 ET on Thurs, Sept 9, 2021
No late HW is accepted. Instead, we drop your two lowest HW grades. We are using Gradescope for turning in HW; see relevant
information on the course Canvas site. Gradescope will always be set to accept HW solutions until 11:59 PM = 23:59 ET (same time
zone as NY City). The three hour difference is a grace period. Technically, after 9 PM ET you are late, and if you try to turn in your
HW solution at midnight Ann Arbor time, or later, we have no guilt in refusing it.
Remarks: The initial lectures in ROB 101 are not required for working Problems 1 through 5 in this HW set. Problem 6 needs the
first week of class. Hints are given at the very end of the HW set. We put the hints at the end so that you can first attempt a problem
on your own without consulting the hints.
Remarks: When uploading to your HW solution to GradeScope, you must associate each of the problems to the page of your scanned
HW solution where its solution BEGINS. Typesetting your solutions is allowed but will not improve your grade. It is assumed that
most of you will write the answers out by hand. You can use pen or pencil, we do not care; please be kind and think of the grader
when composing your solutions. You are allowed to place multiple solutions on a single page. We do ask that the solutions be given
in the same order as the problems! Can you write on both sides of a page? It’s fine for us as long as you can make a clear pdf image
of each page of your solutions for uploading to GradeScope.
There are six (6) HW problems plus a jupyter notebook to complete and turn in.
1. Read Chapter 1 of our ROB 101 Booklet, Notes for Computational Linear Algebra; you will find a copy on
our Canvas site, in the file folder. Based on your reading of the Chapter, summarize in your own words:
(a) the purpose of the Chapter;
(b) two things you found the most interesting.
There are no “right” or“ wrong” answers, but no answer means no points. The goal is to reflect a bit on what you are learning
and why.
2. Lines in the plane
(a) On a single graph, with horizontal axis x and vertical axis y, sketch the two lines y = 0.5x + 1 and y = −x + 4. Find a
point (x∗ , y ∗ ) where they cross one another (read the values as closely as you can from the graph, say to an accuracy of
±0.5). Is there more than one point on the plane where the two lines cross?
(b) Optional (means you are not required to work this part): Can you relate the point you found to the following system of
linear equations?
x − 2y = −2
x+y =4
(c) Remark: Sketching the graphs by hand is perfectly fine and is what we expect most of you to do. It is also OK to make
the plots using Julia or any other software package. Hand sketched plots will receive the same marks as a computer
generated plot.
1
3. Lines in the plane
(a) On a single graph, with horizontal axis x and vertical axis y, sketch the two lines y = 2x + 1 and y = 2x + 4. Can you
find a point (x∗ , y ∗ ) where they cross one another (read the values as closely as you can from the plot, say to an accuracy
of ±0.5)? If you cannot find a point where the two lines intersect, explain why not?
(b) Optional: Can you relate the results of your graph to the following system of linear equations?
2x − y = −1
1
−x + y = 2
2
4. Plot the graph of the quadratic equation y = 2x2 + x − 4, for −3 ≤ x ≤ 3. From the graph, approximately find the two values
of x where y = 0. Repeat for y = 2. (read the values as closely as you can from the plot, say to an accuracy of ±0.25)
5. Consider the equation 2x2 + 3x − 2 = 0
(a) Evaluate its discriminant (see Chapter 1 or the Hints)
(b) You should have found that the discriminant is positive and hence the equation has two real solutions. Compute them
using the quadratic formula (see Chapter 1 or the Hints).
6. Consider a system of linear equations with two unknowns
y − 4z = 2
2y − 10z = −2
(a) Solve the system of equations. Show all the steps when determining your solution. You do not need to generate a plot.
(b) Write the system in the form Ax = b, where you clearly identify A, x, and b. This will require some material from
Chapter 2; see also the Hints.
This is the end of the drill problems. The second part of the HW set will introduce you to the Julia Programming Language
via jupyter notebooks. Please go to the course Canvas Site, click on the link for IllumiDesk, and find the assignment
titled "juliahw1". This assignment will be completed in IllumiDesk, a cloud-hosted jupyter notebook environment for the Julia
programming language. IllumiDesk will be active by the first day of class. We will teach you Julia programming in the LAB
sections.
2
Hints
Hints: Prob. 1 There is no absolutely right or wrong answer. The purpose of the problem is to have you reflect on the material.
Suggested length: 20 words.
Hints: Prob. 2 (a) Recall that with y = mx + b, the slope m is the “rise” in the y-direction divided by the “run” in the x-direction,
while the y-intercept is given by b. Here is a sample plot for y = 21 x + 2. For (b), what is the definition of a solution of a set of
equations?
Hints: Prob. 3 See Hints for Prob. 2.
Hints: Prob. 4 One method is to compute a few pairs of points (x, y) that lie on the curve, and then “smoothly” connect the points.
For example, below is a plot of a quadratic equation
ax2 + bx + c,
for a = 1, b = 3, c = 5. This is what your instructors do when making plots by hand.
Ignore this on your first reading: While you do not need to be so precise on your HW plots, suppose you want to know the minimum
value of y for a parabola that is curved upwards, or the maximum value of y for one that is curved downwards? You can find it by
3
solving the equation
2ax + b = 0.
b
For the plot above, the minimum value of y occurs at x = − 2a = − 23 = −1.5. The value of y at that point is then
y = ax2 + bx + c x=−b/2a
,
and for the plot above it is
y = (−1.5)2 + 3 · (−1.5) + 5 = 2.75
In case you are curious, these two facts come from Calculus, which we are NOT assuming as background in ROB 101.
Hints: Prob. 5 Let ax2 + bx + c = 0 be a quadratic equation. We assume a 6= 0 because, otherwise, it is at most a linear equation.
(a) A value of x that solve an equation of the form f (x) = 0 is often called a root. You can also call it a solution. Calling the
solution a “root” is especially prevalent when the equation is a polynomial, such as a quadratic equation. It is fairly uncommon
to use the term “root” when discussing solutions of linear equations.
(b) The discriminant of a quadratic equation is ∆ := b2 − 4ac. A quadratic equation has roots that are real numbers if, and only
if, ∆ ≥ 0.
(c) If the discriminant is negative, then the roots of the equation are complex numbers. In ROB 101, we will encounter complex
numbers now and then. We will talk about them before we use them so don’t worry if you have not yet seen the concept of
complex numbers.
(d) What does that funny symbol := mean? It’s a refined version of , as in ∆ , b2 − 4ac, a form that may be more familiar to you
when a definition is being made. Professional mathematicians do not use , in their publications, and since your instructors are
likely to slip in :=, you might as well get used to the “more professional” notation.
(e) Here is a worked example that provides example code for plotting. It is perfectly fine for you to do hand sketches!
• Evaluate the discriminant of 2x2 + 3x + 2.
∆ := b2 − 4ac = −7
Discriminant is less than zero. Hence, there are no real roots.
Example Julia code to calculate discriminant:
1 a=2.0; b=3.0; c=2.0
2 discriminant = b^2-4.0*a*c
• Plot the graph of y = 2x2 + 3x + 2 along with the minimum value of y
b
The minimum occurs at x = − 2a = −0.75. We then compute the value of y at the minimum, y = ax2 +bx+c|x=−b/2a =
0.875. Because the minimum value of y is strictly greater than 0, the plot never crosses the y = 0 axis, and hence there
are no real roots.
Example Julia code to plot the graph
1 # Plot the graph to see whether it crosses the x axis or not
2 # Define a function f that returns 2x^2 + 3x + 2
3 f(x::Float64) = x^2 + 3x + 5
4 # Plot y = 2x^2 + 3x + 2
5 plot(f, -5.0, 3, label="y = 2x^2 + 3x + 2")
6 plot!(xaxis=(font(12), "X", -6:1:3), yaxis=(font(12), "Y", 0:5:25), leg=true)
7
4
8 #Optional Where is the minimum of the parabola a x^2 + b x + c?
9 #
10 a=1; b=3; c=5
11 min_x=-b/(2*a)
12 min_y = a*(min_x)^2 + b*min_x + c
13
14 scatter!([min_x], [min_y], label="Minimum Value")
15
Hints: Prob. 6 We’ll work a similar example for you.
Find the solution of
2z − y = −1
1
−z − y = 2
2
As in lecture,
2z − y = −1 =⇒ z = −1/2 + y/2
−z − y/2 = 2 =⇒ −(−1/2 + y/2) − y/2 = 2
=⇒ −y = 1.5
=⇒ y = −1.5
going back to the top
z = −1/2 + y/2 =⇒ z = −5/4
Therefore, z = −5/4 = −1.25, y = −3/2 = −1.5.
5
Write the system of linear equations in the form Ax = b.
z
If we define x = , then we have
y
2z − y = −1
2 −1 z −1
1 ⇐⇒ = .
−z − y = 2 −1 −1/2 y 2
2 | {z } | {z } | {z }
A x b
y
If instead we define x = , then we have
z
2z − y = −1 −y + 2z− = −1
−1 2 y −1
1 ⇐⇒ 1 ⇐⇒ = .
−z − y = 2 − y−z =2 −1/2 −1 z 2
2 2 | {z } | {z } | {z }
A x b
Both solutions are valid.