Write v = v i
j
k and w
i
j
k. Then by Steps 3 and 4, we have
1
+ v 2 + v 3
= w 1 + w 2 + w 3
195
n(v, w) = n( v i
j
k, w i
j
k)
1
+ v 2 + v 3
1
+ w 2 + w 3
= n( v i
j
k, w i)
i
j
k, w j
k)
1
+ v 2 + v 3
1
+ n( v 1 + v 2 + v 3
2
+ w 3
= n( v i
j
k, w i)
i
j
k, w j)
i
j
k, w k)
1
+ v 2 + v 3
1
+ n( v 1 + v 2 + v 3
2
+ n( v 1 + v 2 + v 3
3
= −n( w i, v i
j
k)
j, v i
j
k)
k, v i
j
k).
1
1
+ v 2 + v 3
+ −n( w 2
1
+ v 2 + v 3
+ −n( w 3
1
+ v 2 + v 3
We can use Steps 1 and 2 to evaluate the three terms on the right side of the last equation
above:
−n( w i, v i
j
k)
i, v i)
i, v j)
i, v k)
1
1
+ v 2 + v 3
= −n( w 1
1
+ −n( w 1
2
+ −n( w 1
3
= − v w n(i, i)
w n(i, j)
w n(i, k)
1
1
+ − v 2 1
+ − v 3 1
= − v w (i
w (i
w (i
1
1
× i) + − v 2 1 × j) + − v 3 1 × k)
= − v w 0
w k
w (
1
1
+ − v 2 1
+ − v 3 1 −j)
−n( w i, v i
j
k)
w k
w j
1
1
+ v 2 + v 3
= − v 2 1
+ v 3 1
Similarly, we can calculate
−n( w j, v i
j
k)
w k
w i
2
1
+ v 2 + v 3
= v 1 2
− v 3 2
and
−n( w j, v i
j
k)
w j
w i .
3
1
+ v 2 + v 3
= − v 1 3 + v 2 3
Thus, putting it all together, we have
n(v, w) = − v w k
w j
w k
w i
w j
w i
2
1
+ v 3 1 + v 1 2
− v 3 2 − v 1 3 + v 2 3
= ( v w
w )i
w
w )j
w
w )k
2
3 − v 3
2
+ ( v 3 1 − v 1 3
+ ( v 1 2 − v 2 1
= v × w by definition of the cross product.
∴ n(v, w) = v × w for all vectors v, w.
So since v, w, n(v, w) form a right-handed system, then v, w, v × w form a right-handed
system, which completes the proof.
Appendix C
3D Graphing with Gnuplot
Gnuplot is a free, open-source software package for producing a variety of graphs. Versions
are available for many operating systems. Below is a very brief tutorial on how to use
Gnuplot to graph functions of several variables.
INSTALLATION
1. Go to http://www.gnuplot.info/download.html and follow the links to download the lat-
est version for your operating system. For Windows, you should get the Zip file with a
name such as gp420win32.zip, which is version 4.2.0. All the examples we will discuss
require at least version 4.2.0.
2. Install the downloaded file. For example, in Windows you would unzip the Zip file you
downloaded in Step 1 into some folder (use the “Use folder names” option if extracting
with WinZip).
RUNNING GNUPLOT
1. In Windows, run wgnuplot.exe from the folder (or bin folder) where you installed Gnu-
plot. In Linux, just type gnuplot in a terminal window.
2. You should now get a Gnuplot terminal with a gnuplot> command prompt. In Windows
this will appear in a new window, while in Linux it will appear in the terminal window
where the gnuplot command was run. For Windows, if the font is unreadable you can
change it by right-clicking on the text part of the Gnuplot window and selecting the
“Choose Font..” option. For example, the font “Courier”, style “Regular”, size “12” is
usually a good choice (that choice can be saved for future sessions by right-clicking in the
Gnuplot window again and selecting the option to update wgnuplot.ini).
3. At the gnuplot> command prompt you can now run graphing commands, which we will
now describe.
GRAPHING FUNCTIONS
The usual way to create 3D graphs in Gnuplot is with the splot command:
splot <range> <comma-separated list of functions>
196
197
For a function z = f ( x, y), <range> is the range of x and y values (and optionally the range
of z values) over which to plot. To specify an x range and a y range, use an expression of the
form [ a : b][ c : d], for some numbers a < b and c < d. This will cause the graph to be plotted for a ≤ x ≤ b and c ≤ y ≤ d.
Function definitions use the x and y variables in combination with mathematical operators,
listed below:
Symbol
Operation
Example
Result
+
Addition
2 + 3
5
−
Subtraction
3 − 2
1
*
Multiplication
2*3
6
/
Division
4/2
2
**
Power
2**3
23 = 8
exp( x)
ex
exp(2)
e 2
log( x)
ln x
log(2)
ln 2
sin( x)
sin x
sin(pi/2)
1
cos( x)
cos x
cos(pi)
−1
tan( x)
tan x
tan(pi/4)
1
Example C.1. To graph the function z = 2 x 2 + y 2 from x = −1 to x = 1 and from y = −2 to y = 2, type this at the gnuplot> prompt:
splot [-1:1][-2:2] 2*x**2 + y**2
The result is shown below:
2 ∗ x ∗ ∗2 + y ∗ ∗2
7
6
5
4
3
2
1
0
2
1.5
1
0.5
-1
0
-0.5
-0.5
0
-1
0.5
-1.5
1 -2
198
Appendix C:
3D Graphing with Gnuplot
Note that we had to type 2*x**2 to multiply 2 times x 2. For clarity, parentheses can be used
to make sure the operations are being performed in the correct order:
splot [-1:1][-2:2] 2*(x**2) + y**2
In the above example, to also plot the function z = ex+ y on the same graph, put a comma
after the first function then append the new function:
splot [-1:1][-2:2] 2*(x**2) + y**2, exp(x+y)
By default, the x-axis and y-axis are not shown in the graph. To display the axes, use this
command before the splot command:
set zeroaxis
Also, by default the x- and y-axes are switched from their usual position. To show the axes
with the orientation which we have used throughout the text, use this command:
set view 60,120,1,1
Also, to label the axes, use these commands:
set xlabel "x"
set ylabel "y"
set zlabel "z"
To show the level curves of the surface z = f ( x, y) on both the surface and projected onto the
x y-plane, use this command:
set contour both
The default mesh size for the grid on the surface is 10 units. To get more of a colored/shaded
surface, increase the mesh size (to, say, 25) like this:
set isosamples 25
Putting all this together, we get the following graph with these commands:
set zeroaxis
set view 60,120,1,1
set xlabel "x"
set ylabel "y"
set zlabel "z"
set contour both
set isosamples 25
splot [-1:1][-2:2] 2*(x**2) + y**2, exp(x+y)
199
2 ∗ x ∗ ∗2 + y ∗ ∗2
6
5
4
25
3
20
2
1
15
exp( x + y)
10
z
20
z 5
15
0
10
5
-1
-0.5
-2
0
-1.5 -1
x
-0.5 0
0.5
0.5
y
1 1.5
1
2
The numbers listed below the functions in the key in the upper right corner of the graph
are the “levels” of the level curves of the corresponding surface. That is, they are the num-
bers c such that f ( x, y) = c. Because of the large number of level curves, the key was put
outside the graph with the set key outside command. If you do not want the function key
displayed, it can be turned off with this command: unset key
PARAMETRIC FUNCTIONS
Gnuplot has the ability to graph surfaces given in various parametric forms. For example,
for a surface parametrized in cylindrical coordinates
x = r cos θ ,
y = r sin θ ,
z = z
you would do the following:
set mapping cylindrical
set parametric
splot [a:b][c:d] v*cos(u),v*sin(u),f(u,v)
where the variable u represents θ, with a ≤ u ≤ b, the variable v represents r, with c ≤ v ≤ d, and z = f ( u, v) is some function of u and v.
Example C.2. The graph of the helicoid z = θ in Example 1.34 from Section 1.7 (p. 49) was created using the following commands:
200
Appendix C:
3D Graphing with Gnuplot
set mapping cylindrical
set parametric
set view 60,120,1,1
set xyplane 0
set xlabel "x"
set ylabel "y"
set zlabel "z"
unset key
set isosamples 15
splot [0:4*pi][0:2] v*cos(u),v*sin(u),u
The command set xyplane 0 moves the z-axis so that z = 0 aligns with the xy-plane (which
is not the default in Gnuplot). Looking at the graph, you will see that r varies from 0 to 2,
and θ varies from 0 to 4 π.
PRINTING AND SAVING
In Windows, to print a graph from Gnuplot right-click on the titlebar of the graph’s window,
select “Options” and then the “Print..” option. If that does not work on your version of
Gnuplot, then go to the File menu on the main Gnuplot menubar, select “Output Device ...”,
and enter pdf in the Terminal type? textfield, hit OK. That will allow you to print the graph
as a PDF file.
To save a graph, say, as a PNG file, go to the File menu on the main Gnuplot menubar,
select “Output Device ...”, and enter png in the Terminal type? textfield, hit OK. Then, in the
File menu again, select the “Output ...” option and enter a filename (say, graph.png) in the
Output filename? textfield, hit OK. Now run your splot command again and you should see
a file called graph.png in the current directory (usually the directory where wgnuplot.exe is
located, though you can change that setting using the “Change Directory ...” option in the
File menu).
In Linux, to save the graph as a file called graph.png, you would issue the following com-
mands:
set terminal png
set output ’graph.png’
and then run your splot command. There are many terminal types (which determine the
output format). Run the command set terminal to see all the possible types. In Linux,
the postscript terminal type is popular, since the print quality is high and there are many
PostScript viewers available.
To quit Gnuplot, type quit at the gnuplot> command prompt.
GNU Free Documentation License
Version 1.2, November 2002
Copyright ©2000,2001,2002 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies of this license document, but
changing it is not allowed.
Preamble
The purpose of this License is to make a manual, textbook, or other functional and useful
document "free" in the sense of freedom: to assure everyone the effective freedom to copy
and redistribute it, with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way to get credit for their
work, while not being considered responsible for modifications made by others.
This License is a kind of "copyleft", which means that derivative works of the document
must themselves be free in the same sense. It complements the GNU General Public License,
which is a copyleft license designed for free software.
We have designed this License in order to use it for manuals for free software, because free
software needs free documentation: a free program should come with manuals providing the
same freedoms that the software does. But this License is not limited to software manuals; it
can be used for any textual work, regardless of subject matter or whether it is published as a
printed book. We recommend this License principally for works whose purpose is instruction
or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that contains a notice
placed by the copyright holder saying it can be distributed under the terms of this License.
Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The "Document" , below, refers to any such manual
or work. Any member of the public is a licensee, and is addressed as "you" . You accept
the license if you copy, modify or distribute the work in a way requiring permission under
copyright law.
A "Modified Version" of the Document means any work containing the Document or a
portion of it, either copied verbatim, or with modifications and/or translated into another
language.
201
202
GNU Free Documentation License
A "Secondary Section" is a named appendix or a front-matter section of the Document
that deals exclusively with the relationship of the publishers or authors of the Document
to the Document’s overall subject (or to related matters) and contains nothing that could
fall directly within that overall subject. (Thus, if the Document is in part a textbook of
mathematics, a Secondary Section may not explain any mathematics.) The relationship
could be a matter of historical connection with the subject or with related matters, or of
legal, commercial, philosophical, ethical or political position regarding them.
The "Invariant Sections" are certain Secondary Sections whose titles are designated,
as being those of Invariant Sections, in the notice that says that the Document is released
under this License. If a section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero Invariant Sections.
If the Document does not identify any I