You are on page 1of 2

Math 21b – Homework 01

Due Wednesday, February 2 (MWF lectures), or Thursday, February 3 (TTh lectures).

Mathematica: Throughout the semester, you will be asked to experiment with the software package, Mathematica.
It is available to all Harvard students for download, and also installed in the computer labs in the Science Center. Your
first Mathematica assignment is to find a place to use the software. Either download it (there are detailed instructions
on the “Homework” tab of the course webpage) or make sure that you know how to use it in the computer lab.
1. First steps with Mathematica: Here are a couple of things to try with Mathematica. If you haven’t been able to get
Mathematica working yet, you may use the on-line version at www.wolframalpha.com by typing the same commands
into the search bar at that webpage.
(a) Type the line below exactly as it appears into your copy of Mathematica (square and curly braces and commas
are important!):
Plot[3x - 5, {x, -3, 7}]
Hold down the “Shift” key and hit “Enter”. (If you’re using WolframAlpha, then just Enter will do.) We hope
that you recognize the output as the graph of the line y = 3x − 5. Now change the values of the “-3” and the “7”
to different numbers. What effect does this have on the plot that Mathematica outputs?
(b) Try the following command:
ContourPlot[3x - y == 5, {x, -3, 7}, {y,-20,20}]
Don’t forget to hold “Shift” when you hit “Enter” (this is how you tell Mathematica to evaluate the line of code).
This time we’re using the Mathematica ContourPlot command instead of the Plot command. The “arguments”
(i.e. inputs) of this command are the things inside the square brackets – the first argument is everything after
the first square bracket and before the first comma. What is the difference between the first argument of the
ContourPlot command and the first argument of the Plot Command? What are the arguments {x, -3, 7} and
{y,-20,20} doing? (If you can’t tell, try experimenting with different numbers to see how it affects the output.)1
x2 y2
(c) Use one of the commands above to plot the ellipse 25 + 4 = 1 in a suitable range. Write out the complete
command that you used.
2. (a) (Bretscher #1.1.2 ) Find all solutions of the following linear system using elimination as discussed in Section 1.1.
Then check your solutions.
4x + 3y = 2

7x + 5y = 3

(b) (Bretscher #1.1.4 ) Find all solutions of the following linear system using elimination as discussed in Section 1.1.
Then check your solutions.
2x + 4y = 2

3x + 6y = 3

(c) Computer algebra systems such as Mathematica can solve systems of linear equations very quickly. Enter the
following command into Mathematica, exactly as written, to again check your answer to part (a).
Solve[{ 4x + 3y == 2, 7x + 5y == 3}, {x, y} ].
Then do the same for the system in part (b). Note that in this case the output may look quite different from what
you wrote in part (b). If so, be sure to check that you are getting the same answer both ways.
3. (based on Bretscher #1.1.14 )
(a) Find by hand all solutions of the following linear system. Show all of your work.

x + 3y − z = 0

3x + y + 5z = 0

5x − y + 11z = 1

(b) Describe your solutions in terms of intersecting planes.


(c) What do you think Mathematica will output for this system of equations? Check by using the “Solve” command
as in Problem #2 above.
1 The default options for the command “ContourPlot” are different than those for “Plot”, so your two plots in Problem #1 will have some

superficial differences. If you want to make the output in part (b) look more like the output in part (a), try specifying some options, as in the
following command: ContourPlot[3 x - y == 5, {x, -3, 7}, {y, -20, 20}, Axes -> True, Frame -> False].

1
4. Bretscher #1.1.20
5. (based on Bretscher #1.1.22 ) Consider the differential equation

d2 x dx
− − x = cos(t).
dt2 dt
This equation could describe a forced damped oscillator, as we will see in Chapter 9. We are told that the differential
equation has a solution of the form
x(t) = a sin(t) + b cos(t).
(a) Find a and b.
(b) Use Mathematica (or WolframAlpha) to graph the solution. Your graph should show at least two periods of the
solution, and the scale should be such that the approximate maximum and minimum values of x(t) are apparent.
6. Bretscher #1.1.28

7. Bretscher #1.1.30
8. Bretscher #1.1.38
9. Bretscher #1.1.46

10. Bretscher #1.2.8


11. Bretscher #1.2.18
12. (based on Bretscher #1.2.22 ) How many types of 3 × 4 matrices in reduced row-echelon form are there? (See Exercise
1.2.20.)

You might also like