Skip navigation

Category Archives: math

4d space is simply overlapping 3d volumes.

each dimension you add multiplies the previous dimension by infinitely many of the previous “type” of object.

For example:
0d: a point.
1d: a 1d line, or infinite stack of parallel 0d points
2d: a 2d plane, or infinite stack of parallel 1d lines
3d: a 3d volume, or infinite stack of parallel 2d planes
4d: 4d space, or “infinite stack” of parallel 3d volumes

parallel 3d volumes may seem hard to visualize, until you realize that they are just overlapping 3d spaces.

if you know computer graphics, think of rendering the same thing twice in the same spot. for example, a character, once with normal skin and once with werewolf skin. the second render introduces a “4th dimension” or a “parallel reality” for the character. if both renders are supposed to represent the same character, and these impassible objects can overlap, then we are now talking about parallel 3d spaces (since overlap of solid objects should not be possible in a single 3d space). the character now appears in 4d space, where he experiences the “parallel realities” of both being “normal” and “werewolf skinned” at the same time.

On Rotation Matrices

A common problem you come across is GIVEN a vector describing a “look” direction, HOW CAN WE MAKE A ROTATION MATRIX THAT WILL “LINE UP” WITH IT? You often want to do something like this when you have a character model that you need to rotate to line up with the direction that the character is currently facing. For example, you are writing a 3d space simulator game and you need the ship’s model to be lined up precisely with the direction the ship is facing.

It turns out, this is easy to do. So easy to do in fact, you’ll kick yourself for not having known this. But it isn’t easy to understand how it works.

So, first, let’s understand the principles of what we’re doing here in 2d, then we’ll extend our answer to 3d.

Rotating something to line up with an object in 2d

Assume you work in a world of vectors. In your 2d game, you need to have the model of your character point in the direction that he is looking.

Have: (red arrow is direction the Triangle character is looking).

But the black triangle and black arrow indicate the stock direction the model faces.


The most obvious way to solve this problem is just a 2d rotation matrix.

Matrix that rotates a point t degrees counter-clockwise:

The Triangle starts with its Heading vector pointing (1, 0). What we need to do is rotate the Heading vector 60 degrees counter-clockwise.

To make a 60 degree CCW rotation, let’s use the CCW rotation matrix, plugging in 60 degrees for the rotation we want:

So we end up with this set of numbers that promise to rotate a set of points 60 degrees counterclockwise:

Now here’s another way to get that same matrix. Are you ready?

The red vector (which points in the direction we want to face) is called the forward vector. The blue vector, we’ll simply call the side vector. ASSUME BOTH THE forward AND side vectors are UNIT VECTORS (THIS IS VERY IMPORTANT!!)

Since we know the forward vector is a unit vector and it has a 60 degree angle with the x-axis, we can express it as:
xfwd = cos( 60 )
= 0.5

yfwd = sin( 60 )
= 0.86

So a unit vector in the plane, when broken down into its x, y components, is always going to be x=cos(t), y=sin(t) where t is the angle that the vector forms with the +x axis.

The blue vector makes (90+60=150) degree angle with the +x axis. So it can be expressed as:
xperpleft = cos( 150 )
= -0.86

yperpleft = sin( 150 )
= 0.5

So, speaking in terms of the orientation we want, we have two vectors:

forward (describes direction we want to look in)=( 0.5, 0.86 )
perpleft (90 degrees counter-clockwise perpendicular to the forward vector) = ( -0.86, 0.5 )

We could also derive the perpleft vector by noticing that ( -y, x ) is always going to be a 90 degree counter-clockwise rotated perpendicular to any vector you have.

side note:
You are sure that (-y,x) is a perpendicular to (x,y) because the dot product:
(x,y)*(-y,x) = -yx + xy = 0

and so, (-y,x) is always perpendicular to (x,y).

The other way to derive this is to construct the 90 degree CCW rotation matrix and notice that it always comes out to

[ cos(90)   -sin(90) ] [ x ]
[ sin(90)    cos(90) ] [ y ]

[ 0   -1 ] [ x ] = [ -y ]
[ 1    0 ] [ y ]   [  x ]

So, look at those again:

forward: ( 0.5, 0.86 )
perpleft: ( -0.86, 0.5 )

Does that look familiar?

So we can do this:

Assuming you use column vectors and not row vectors. If you’re using row vectors, you have to transpose it.

Isn’t that neat?

This extends to 3D:

At this point, I’ll direct you to Diana Gruber’s article and leave it at that.

Say you come across

What you do is
break it up

Here’s a great link to the purple math site (a great site).

Matlab plot syntax is easy to use but apparently easy to forget.

Here I’m plotting the line y = x2 from x = -20 to +20.

% generate x, y vectors
x = -20:0.01:20;   % x goes from -20 to 20 in steps of 0.01
y = x.^2;            % generate y

y = x^2

Hmm the plot would be easier to see if it had grid lines drawn in.

% generate x, y vectors
x = -20:0.01:20;   % x goes from -20 to 20 in steps of 0.01
y = x.^2;            % generate y
grid on;

Hmm, I want to zoom the plot in so it shows from -2 to +2 of the x-axis and from -1 to +3 of the y-axis.

% generate x, y vectors
x = -20:0.01:20;   % x goes from -20 to 20 in steps of 0.01
y = x.^2;            % generate y
grid on;
axis( [-2, 2, -1, 3] );  % NOTICE this goes AFTER the plot() command
% axis( [ xmin, xmax, ymin, ymax ] ) ;
% you must have the [], the axis function takes ONE argument with vector type, not 4 different arguments.

Finer control

We can get much finer control over our matlab plots by ACQUIRING THE HANDLE to the axes.

The axes exist as an object in memory somewhere inside the MATLAB “machine”. The ‘handle’ to the axes is YOUR POINTER that you can use to make changes to that axes object, even though the MATLAB program isn’t fully under your control. You have control over PARTS of MATLAB THROUGH these handles you can get.

This is easy.

So howdya get the handle?

% generate x, y vectors
x = -20:0.01:20;   % x goes from -20 to 20 in steps of 0.01
y = x.^2;            % generate y

HANDLE = gca;  % "get current axis handle" . . gives you "handle" to the axes that belong to the plot you JUST made.
% Remember, a HANDLE to the axes are just a programmatic "means to control" the axes.

% now try this
get( HANDLE );

%% wow!  you'll see a huge listing here like
%	ActivePositionProperty = outerposition
%	ALim = [0 1]
%	ALimMode = auto
%	AmbientLightColor = [1 1 1]
%	Box = on

% You can customize any of these by choosing something, then SETTING the property using the SET function.

% e.g. let's change the background color to dark blue, and the axes color to 
set( HANDLE, 'Color', [0,0.1,0.2] ); %background color to dark blue

How do you change the color of the matlab plot itself?

% generate x, y vectors
x = -20:0.01:20;   % x goes from -20 to 20 in steps of 0.01
y = x.^2;            % generate y
plothandle = plot(x,y);

% now try this
get( plothandle ) ;
%lists all properties you can change of the PLOT itself

set( plothandle, 'Color', [ 1, 0.5, 0 ] );  % plot color to orange
set ( plothandle, 'LineWidth', 1.5 );   % make matlab plot line wider

altered colored matlab plot . . the altered beast if you will

All the stuff in this section uses code like:

set( HANDLE, 'PropertyName', PropertyValue ) ;

Note that if you use gca, you will be modifying THE WHOLE PLOT. If you use the plothandle = plot(x,y), then you will be modifying ONLY THAT LAST PLOT WHICH YOU CREATED.

So, to do things like MODIFY THE AXIS LABELS, you’d do something like this:

x = 0:0.01:2*pi ;
y = sin( x ) ;
hold off ; % REPLACE last plot with the new one I'm
% about to draw (if any already existed onscreen)

h = plot( x, y ) ; % SAVE THE HANDLE so we can
% modify the plot lines
set( h, 'Color', [1,0,0] ) ; % change color of the
% sin(x) plot to (100% red, 0% green, 0% blue)
set( h, 'LineWidth', 1.5 ) ;
hold on ;  % keep the last plot on while we
% put a new plot
y = cos( x ) ;
h = plot( x, y ) ; %SAVE THE HANDLE to the cos(x) plot
% so we can change its color below

set( h, 'Color', [0,0,1] ) ;%cos(x) plot (0% r, 0% g, 100% b )
set( h, 'LineWidth', 1.5 ) ;%widen pen width
axis( [ 0, 2*pi, -2, 2 ] ) ;% ZOOM TO 
% [ xmin, xmax, ymin, ymax ]

set( gca, 'XTick', 0: pi/2 : 2*pi ); % make the ticks on
% the x-axis get labelled:  
% so from 0 TO 2*pi IN STEPS OF (pi/2).

set( gca, 'XTickLabel', { 'ZEER', 'pi/2', 'pi', '3PI/2', '2*pi' } ) ; %
% labels are 'ZEER', then pi/2, then pi, then 3*pi/2..
% notice these are simply TEXT labels, they are not computed
% or interpretted in any way (they are blindly pasted onto
% the plot axis) so, if you don't supply enough labels
% then MATLAB will wrap back to your first label, like an IDIOT!!

set( gca, 'Color', [0.25,0.9,0.7] ) ; % change color of
% the entire axis i.e the background-color

// ref (bad link)
ref (new link)


Understanding epsilon-delta proofs

First, get and read this. Really good.

before you even START with epsilon-delta . . .

| x – 3 | < 1;

SAYS in English “x is within 1 unit of 3.”

You have to be fluent with that idea before starting ε-delta; proofs.

Let’s look at a picture of this inequality on the real number line:

x lies here

So for example, if x = 2.8:

| 2.8 - 3 | < 1
| -0.2 | < 1
0.2 < 1    ===   TRUE

Now let’s try for x = 3.5.

| 3.5 - 3 | < 1
| 0.5 | < 1
0.5 < 1   ===   TRUE

So, | x – 3 | < 1 MEANS x must be within 1 unit of 3 on the real number line.

To be able to understand epsilon-delta at all, you have to get into the habit of looking at an inequality like

| x – 10 | < 5

And immediately just say in a snap “That inequality says that x is within 5 units of 10”

| x – 0.4 | < 0.00001

And say “That inequality says that x is within 0.00001 units of 0.4.”

In general, for any inequality with the format:

| x – c | < a

That says in plain english that “x is within a units of c.”

Epsilon-delta proofs are actually easy.

The meat of epsilon-delta proofs

The meat of epsilon-delta proofs is just this idea.

0 < | x – c | < δ

| f(x) – L | < ε

Epsilon-delta says:

AS WE RESTRICT x to being within δ units of c, then, as a result of that restriction, f(x) becomes restricted to being within ε units of L.

If the above statement is true, then and only then can we say

lim   f(x) = L

So, here’s the “definition of a limit”, but with more explanation in English words:

The limit:

lim f(x) = L

exists if and only if

when we restrict x to be within δ units of c,

0 < | x – c | < δ

then, as a consequence of that restriction, we in effect are restricting f(x) to be within ε units of L.

| f(x) – L | < ε

If that happens, then we know that the limit of f(x) as x -> c is equal to L.

Ok, but how do you do an epsilon-delta proof?

So here’s an example of how this stuff works.

Use epsilon-delta to "show" that

lim  3x - 3  =  12

I know what you’re thinking. “Can’t we just do this:”

lim  3x - 3

= 15 - 3

= 12

but nooooooo! That’s not good enough for epsilon-stupid. You must “show” it.

Use epsilon-delta to "show" that

lim  3x - 3  =  12

So, what we use the “definition of a limit” as stated at the top of this page (you should memorize it really for use on tests (YES they DO ALWAYS put epsilon-delta on tests . . )

The limit above exists if and only if for each ε > 0, there exists a δ > 0 such that:

    0 < | x - c | < δ            [ c = 5 though, plug in: ]
    0 < | x - 5 | < δ

      | f(x) - L | < ε         [ f(x)= 3x - 3, and L = 12, plug in: ]
      | ( 3x - 3 ) - 12 | < ε

So read that in English as:

“IF x is within δ units of 5 . . . ”

“. . . THEN ( 3x – 3 ) is within ε units of 12.”

The key to epsilon-delta proofs is you have to relate epsilon and delta.

You have to argue that IF 0 < | x – 5 | < δ ( x is within δ units of 5 ), THEN we can conclude that | ( 3x – 3 ) – 12 | < ε (THEN ( 3x – 3 ) is within ε units of 12 ).

HMM! Hopefully, this is starting to make some sense. Here is how you proceed.

Let’s work with the THEN part (the | f(x) – L | statement), and break it down a bit:

      | ( 3x - 3 ) - 12 | < ε
      | 3x - 15 | < ε

Let’s FACTOR (because we love to factor)

      | (3)(x - 5) | < ε
     3| (x - 5) | < ε
      | (x - 5) | < ε/3;

That looks familiar! Suddenly, the | f(x) – L | < ε looks a lot like the | x – c | < δ statement.


We can relate the epsilon statement and the delta statement ( 0 < | x – c | < δ ) in this way:

CHOOSE δ = ε/3. (Get used to the idea of “CHOOSING” δ)

Then, we go:

      | x - 5 | < ε/3   [ CHOOSE δ = ε/3 ]

      | x - 5 | < δ

WOW!!!!! How marvellous. It will seem very very strange to you that in the middle of this “mathematical rigor”, we end up going and “choosing” δ = ε/3. You’ll see that this “choice” doesn’t really hurt the “rigor” of what we’re doing though. . . just keep at it.

Next we have to show that this “δ” we’ve chosen ( δ = ε/3 ) “WORKS”.

So we go back to the original statement:

    0 < | x - c | < δ            [ c = 5, chose δ = ε/3 ]
    0 < | x - 5 | < ε/3;

      | f(x) - L | < ε         [ f(x)= 3x - 3, and L = 12, plug in: ]
      | ( 3x - 3 ) - 12 | < ε
      | 3x - 15 | < ε
     3| x - 5 | < ε
      | x - 5 | < ε/3

Wonder of wonders! It “WORKS”, because the statement has now changed from:

“IF x is within δ units of 5 . . . THEN ( 3x – 3 ) is within ε units of 12.”

“IF x is within ε/3 units of 5, THEN x is within ε/3 units of 5.”

Which cannot be argued against.

Remember, its not stupid. Its “rigorous”.

(donation should be to

*This list is being expanded

  • The period . operator.

    You put the . in front of an operator like ^ or * to get “element by element” operation behavior. Its best explained by example.

    Say you have a row matrix called ‘x’ that has 10000 values in it.

    You want a plot of y = x2, so you need to create another row vector to save values of y to put those values in.

    Instead of writing a loop like:

    for( i = 1:length(x) )
    y(i) = x(i)^2;

    Just use the special . notation and write:

    x = -3:0.01:3;
    y = x.^(2);

    Here, .^ means to raise every element of x to the power of 2, not to try to raise the ENTIRE matrix to the power 2 (which clearly generates an error).

    matlab docs ref

In plotting a simple cube root function y = x1/3, you expect to see a graph like this:
Real cube root graph

But when you do

x = -3:0.01:3;
y = x.^(1/3);

You get:
Complex cube root graph


“Pete wanted it that way.”

No, but really. Why is the plot of the cube root complex-valued, and not real-valued?

You should know that there are in fact __3__ cube roots for any number.

For instance, -3 has 1 real, and 2 COMPLEX cube roots:

The three cube roots of -3 are:

  • 0.7211 + 1.2490i
  • 0.7211 – 1.2490i
  • -1.44224

They look like this in the complex plane. Notice that they are separated by 120 degrees.

roots of -3

When you multiply those cube roots together, you get -3 again:

(0.7211 + 1.249i)*(0.7211 - 1.249i)*(-1.44224)
= (2.08)(-1.44224)
= -3

When you do:

x = -3:0.01:3;
y = x.^(1/3);

Matlab is putting the first cube root inside y (values like 0.7211 + 1.2490i as the cube root of -3), hence giving y complex values.

Howdya get it to give you just the real ones? Use Matlab’s nthroot function. For example, try:

x = -3:0.01:3;
y = nthroot( x, 3 );

just see this.

y = nthroot(X, n) returns the real nth root of the elements of X. Both X and n must be real and n must be a scalar. If X has negative entries, n must be an odd integer.


nthroot(-2, 3)
returns the real cube root of -2.

ans =


You can find the slope of a curve

m = lim(x->c) f(x) - f(c)
                 x - c

How to complete the square

Usually you have to complete the square when you’re trying to draw a graph of a parabola that has an equation like:

x2 + 5x + 3 = 0

You only know where the vertex of the parabola goes if you can get it in the form

(x – a)2 + C = 0

The cool thing about “completing the square” is when you do it, you actually will always be able to get any polynomial into that (x – a)2 + C = 0 form.

How to complete the square

Working with our example x2 + 5x + 3 = 0

1 >> Take the 5 (from the 5x term) and divide it by 2.


2 >> Square it.


= 25

3 >> Add AND subtract that squared number from the original polynomial

Now, all you have to do is take that value you just got (25/4) and ADD AND SUBTRACT 25/4 FROM THE ORIGINAL x2 + 5x + 3 = 0.

Here is how you do it (pay special attention to WHERE I’m putting the 25/4):

x2 + 5x + 3 = 0

x2 + 5x + 25/4 - 25/4 + 3 = 0

Now the important thing to realize is that what I’ve just written is completely 100%-ly MATHEMATICALLY EQUAL to the original

x2 + 5x + 25/4 - 25/4 + 3 = x2 + 5x + 3

OK?? Make sure you know that.

4 >> “complete the square”

Next, what you do is, you just write this:

x2 + 5x + 25/4 - 25/4 + 3 = 0

(x + 5/2)2 - 25/4 + 3 = 0

(x + 5/2)2 - 13/4 = 0

Notice the 5/2 value . . . we’ve seen that before (go look where).

And that’s how its done.

We can check that the answer we’ve written is correct by multiplying back out. We should get the original polynomial when we’re done:

(x + 5/2)2 - 13/4 = 0

(x + 5/2)(x + 5/2) - 13/4 = 0

x2 + 2(5/2)x + (5/2)2 - 13/4 = 0

x2 + 5x + 25/4 - 13/4 = 0

x2 + 5x + 12/4 = 0

x2 + 5x + 3 = 0

And that’s the same as the original polynomial.

Ok, that was a specific example. What doing this to polynomials in general?

Just apply the pattern. In general, if you have

x2 + Bx + C = 0

You complete the square by doing this:

x2 + Bx + C = 0

( x + (B/2) )2 - (B/2)2 + C = 0

Note also that if you have a polynomial of the form

Ax2 + Bx + C = 0

You change it to being in the form:

A(x2 + (B/A)x) + C = 0

So for example, given

5x2 + 7x + 10 = 0

5( x2 + (7/5)x ) + 10 = 0

5( x + (7/10) 2 - (7/10)2 ) + 10 = 0

5( x + (7/10) )2 - 49/100 ) + 10 = 0

5( x + (7/10) )2 - (5)(49)/100 + 10 = 0

5( x + (7/10) )2 + 151/20 = 0

Check its correct by multiplying back out.

5( x + (7/10) )2 + 151/20 = 0

5( x2 + 2(7/10)x + 49/100 ) + 151/20 = 0

5x2 + 7x + 49/20 + 151/20 = 0

5x2 + 7x + 10 = 0

Which is the same as the original.

Say you have 2 lines in the plane. You are given their slopes.

The angle between 2 lines in the 2D cartesian plane is given by:

tan( a ) = | (m2 – m1) / (1 + m1m2) |

If the lines are perpendicular, then

m1m2 = -1

and so

(1 + m1m2) = 0

then a = 90 degrees and the lines are perpendicular.

cool conic sections thing

Functions in math can be one of the most confusing topics for the newbie.

I remember struggling this was a totally dreaded topic in high school.

So here’s an explanation that might help with that.

A function is like a vending machine. It takes inputs, and it spits out outputs.

Picture a vending machine like this one:

Vending machine

Surely you’ve seen one of these beastly contraptions sometime.

Ok, now notice how the vending machine has INPUTS: which are just the buttons on the keypad.

Now, to get an output out of the vending machine, what you do is, you put in the correct amount of money ($1), then you input the correct keycode.

So assume that the blue Crunch bar is what I want. It costs $1 and the keycode for it is D3.

So the INPUT is the keycode D3. The OUTPUT is the CRUNCH BAR. The idea of a FUNCTION is that a FUNCTION is something that takes your INPUT, and spits out some OUTPUT, depending on the value you inputted.

So the vending machine IS a FUNCTION. It takes your INPUT (keys pressed), and depending on what keys you pressed, it gives a different OUTPUT (some kind of candy bar).

So::::: Remember this: A FUNCTION is what RELATES the INPUT VALUE to the OUTPUTTED VALUE.

So somewhere inside that vending machine, is a FUNCTION that looks at the keys you INPUTTED and then OUTPUTS the correct chocolate bar or bag of chips or whatever.

But what about MATH functions?

Math functions are easy. Let’s do this by example. Say I have a function:

f(x) = 3x + 5

You have to get used to the notation. Whenever you see something like that, then the whole thing in the box just above this line is called a MATHEMATICAL FUNCTION.

Now, that MATHEMATICAL FUNCTION is really just like our vending machine, if you think about it. The mathematical function has an INPUT (the value of x!), and it has an OUTPUT (the value of f(x)!)

Input? Output?? wtf?

f(x) = 3x + 5

Just watch what I’m doing here and try to follow along.

I am going to find the OUTPUT of the function f(x) when the INPUT is 2.

f(2) = 3(2) + 5
f(2) = 6 + 5
f(2) = 11

Therefore, the OUTPUT of the function f(x) is 11 when the INPUT is 2.

Let’s take it one line at a time.

The first thing you do, is you take the formula

f(x) = 3x + 5

Now, you are asked to find the OUTPUT of the function f(x) when the INPUT is 2.

INPUT IS 2 just means that you have to take the original formula

f(x) = 3x + 5


f(2) = 3(2) + 5

Then you can just see that its plain old math as usual from here. 3 times 2 plus 5 is 11.

f(2) = 6 + 5
f(2) = 11

Domain and Range

Take another look at the vending machine up top.

Notice that the vending machine has keys A to J and then number keys 0 to 9.

If you’ve ever used one of these things, then you know the vending machine only accepts inputs such as A1, A2, D2, or D5, or E9. So the vending machine only accepts your INPUT if you punch in a LETTER, then a NUMBER. You can’t punch in AA, for example. The vending machine wouldn’t understand that because it has no candy bar that it knows to give you for AA.

That is exactly the idea of DOMAIN. The DOMAIN of a FUNCTION IS the set of all INPUTS that the function UNDERSTANDS and CAN give you an OUTPUT for.

What’s the range then? The RANGE is the set of all possible OUTPUTS of the FUNCTION.

So the range of the vending machine above is SOMETHING LIKE:

{ Lays, Ruffles, Fritos, Cirspys, Rold Gold, Crunch, Snickers, Butterfingers . . . } (it goes on but you get the picture)

So looking again at another MATHEMATICAL FUNCTION, let’s find the domain and range of it:

f(x) = 1/x2

What you have to do to determine the DOMAIN of f(x) is just think. Are there any INPUT values of x that I can choose for which f(x) will not have a proper value?

In fact, for f(x) = 1/x, the DOMAIN is {x | x is an element of the set of ALL REAL NUMBERS, x != 0}

x cannot be zero, because 1/0 is undefined (+infinity).

the RANGE is going to be the set of all values that f(x) can take on. Think about what I mean by “take on”. . I mean the set of all possible values that f(x) can have as a result as we give it different values of x.

The range can be harder to know. For the vending machine example, its really easy to know what the range is. You just look through the glass and see the set of all outputs that the vending machine can produce.

For a MATHEMATICAL FUNCTION, the analysis is a bit tougher.


f(x) = 1/x2

We know that as x takes on values from (-minus infinity, plus infinity), f(x) takes on values from just above 0 (when x is extremely large in magnitude), to positive infinity (when x is extremely small in magnitude).


Range = { y | y > 0, y is an element of the real numbers }

Hmm. You might be a bit confused at this point.

It will eventually make sense. Toss the ideas around in your head and you will get it.


Remember, a function is a vending machine.

all about the triangle

mathematical fallacies

Look at this moronic quotation from Salas, Hille and Etgen’s “Calculus: One and Several variables”:

Choose any point P, P != O, in the plane. Let l1 be the line through P parallel to the y-axis and l2 the line through P parallel to the x-axis. Let a be the coordinate of the point of intersection of l1 and the x-axis, and let b be the coordinate of the point of intersection of l2 and the y-axis. Then P is identified with the ordered pair of real numbers (a, b).

I mean, come on. All they’re describing there is how you find a point by an ordered pair in the cartesian plane.

This is some of the worst writing I have ever seen. It is written like a C program where variable declarations are all at the top of the program. “Let l1 be, a be, let b be”… really. People don’t read like computers.

There is a much more human way of writing this, and they haven’t got it.

The strange thing is in their introduction to the text, they promise:

“The mathematical statements are careful and precise; the basic concepts and important points are not obscured by excess verbiage”

To be fair, there are quite a few places where I’ve said to myself “Yes, well done there. That is well stated.” But at other times . . . . they’re not writing for people. They’re writing for themselves and defining things with a degree of rigor that just makes the writing harder to read while imparting no additional understanding to the reader.

here’s a proof

and another

dr math’s

and a funny quote
‘The tools of a mathematician are pencil, paper and waste paper basket. The waste paper basket distinguishes him from a philosopher’

*Expanding list

  1. If a and b have the same sign, then a*b >= 0
  2. In general, A – B ≤ | A – B |
  3. | A – B | ≤ | A | – | B |. This is called the triangle inequality.
  4. | | A | – | B | | ≤ | A – B |. This is an extension of the triangle inequality.
  5. The quotient a / b will end up being a terminating decimal number only if b can be written as the product of 2’s and 5’s when broken down into its prime factors. Stated another way, if you can write b = 2x5y, x ≥ 0, y ≥ 0, then the quotient a / b will be a terminating decimal value when it is calculated (e.g. 3 / 8 = 3 / 23 = 0.375)
  6. Two lines the Cartesian plane are perpendicular if m1m2 = -1
  7. The angle between 2 lines on the cartesian plane is given by:

    tan( a ) = | (m2 – m1) / (1 + m1m2) |

    Notice that if the lines are perpendicular, then the RHS becomes infinity.

  8. The sum of angles in any polygon is (V-2)*180, where V is the number of vertices in the shape. See (V-2) triangles to make any shape
  9. If you’re not sure how to solve a complex problem, try using the principle of superposition ;)
  10. Interesting, but not very useful fact when it comes to programming with math:
    max( a, b ) = 1/2( a + b + | a – b | )

    min( a, b ) = 1/2( a + b – | a – b | )

When is a rational number going to have a repeating decimal?

It turns out there’s a really easy way to find out.

For example, given:


I can tell you from now (without touching a calculator) that will have a TERMINATING DECIMAL.



I can tell you from now (without touching a calculator) that will have a REPEATING DECIMAL.

How do I know?

All you have to do is factor the denominator into its prime factors.

 3         3           3
--- = ----------- = --------
250   (2)(5)(5)(5)  (2)(53)

If the denominator of any fraction has the form 2x5y with x, y positive integers, then that fraction represents a terminating decimal value. Otherwise, the fraction represents a repeating decimal value.

Said another way, if you can break down the denominator to being just a bunch of 2’s times a bunch of 5’s, then the fraction represents a repeating decimal.

More examples:

 3          3
--- = -------------
900   (22) (32) (52)

= --------------
  (22) (3) (52)

I say the above example will have a repeating decimal because the denominator cannot be totally written as the product of 2’s and 5’s.

Checking with Mr. Calculator, I’m right. 3 / 900 = 0.0033333333 (repeating forever).

Now let us try another example:

 9          9
--- = -------------
900   (22) (32) (52)

= ---------
  (22) (52)

So I say this WILL BE a terminating decimal, because the denominator just becomes 2 x 2 x 5 x 5, which is purely the product of 2’s and 5’s.

Indeed, 1/100 = 0.01.

And that’s the way it is.

In order to be able factor easily you first have to totally memorize your 12 times tables.

If you didn’t totally memorize your 12 times tables, then factoring will be really hard for you.

Factoring will be even easier the more times tables you memorize. So you might want to memorize your 16 times tables or even 20 times tables.

Anyway, here’s an example of how you factor.

Say you have something like:

9x2 + 12x + 4

How do you factor that?

  1. First thing you do, is you write on your paper 9 x 4=36.

    In case you didn’t know, the reason we’re doing that is 9 is the number in front of the x2 part, and 4 is the number with no ‘x’ after it. So that is the first number you write down.

  2. The next thing you do is you write down 12. Why is it 12? Because 12 is the number beside the plain ‘x’ (the ‘x’ ALONE, NOT the x2 part).

Ok, so now on your paper you should have this:

STEP 1: 9 x 4 = 36

STEP 2: 12

So here’s what you have to do now. You have to find 2 numbers that MULTILPLY to equal 36, and at the same time, those 2 numbers should ALSO add up to 12.

Hmm. That can be hard to figure out . . . UNLESS YOU KNOW YOUR TIMES TABLES REALLY WELL!! Then its easy. You would know that 6 x 6 = 36. And lo and behold, 6 + 6 = 12. So The numbers are just 6 and 6.

Then, you write:

9x2 + 6x + 6x + 4
= 3x( 3x + 2 ) + 2( 3x + 2 )
= (3x + 2) (3x + 2)
= (3x + 2)2

Numbers have names.

In this post, I’m going to talk about these names:


First, you must know what an INTEGER is, and what a REAL NUMBER is, and the difference between INTEGERS and REAL NUMBERS.

An INTEGER is just a name for ANY WHOLE number. Examples of INTEGERS are:

  • 5
  • -100
  • 20

A REAL NUMBER is just a name for ANY decimal valued number. Examples of REAL NUMBERS are:

  • 5.3
  • -100.402
  • 20

The only difference between REAL NUMBERS and INTEGERS is that REAL NUMBERS are allowed to have something after the decimal point.

INTEGERS are NEVER allowed anything after the decimal point. INTEGERS aren’t allowed to have a decimal point in them at all.

Notice in the last example for a REAL NUMBER, I put plain old 20. 20 is BOTH an INTEGER AND a REAL NUMBER AT THE SAME TIME!!! That’s an important point to understand, and we’ll talk about it again in a second.

First, try these exercises:

Question: Is 1.24 a REAL NUMBER or an INTEGER?
Answer: 1.24 is a REAL NUMBER. 1.24 is NOT an INTEGER because it has a decimal part.

Question: Is 5.929848995681948 a REAL NUMBER or an INTEGER?
Answer: 5.929848995681948 is a REAL NUMBER. 5.929848995681948 is NOT an INTEGER because it has a (huge) decimal part.

Question: Is 5000 a REAL NUMBER or an INTEGER?

To understand this idea that a number can be BOTH a REAL NUMBER and an INTEGER at the same time, just think about the different nicknames you might have for one of your friends. I have a friend named Bob. Bob is really fat. So I have 2 names for Bob:

  • Bob
  • Fatso

In the same way, I have TWO NAMES for the number 5000:



Now here is the deal with RATIONAL NUMBERS.

A RATIONAL number is any REAL number that can be found by dividing two INTEGERS together.

For example, try this on your calculator:


When you do 1 divided by 10, you should see 0.1 on your calculator’s face. Your calculator should also be smiling at you because you gave it a nice short computation.

Just like my friend Bob had 2 names, “Bob” and “Fatso”, we are going to give the number 0.1 TWO NAMES:

  1. REAL NUMBER (because 0.1 clearly has a decimal part)

Why do we say 0.1 is a RATIONAL NUMBER?

0.1 is called a RATIONAL NUMBER because it can be found out by dividing two integers together!!!. That’s really all there is to it.


Using your calculator, try to find out whether each of these numbers are RATIONAL (try to find two integers to divide together that makes your calculator show the number on its face):

  • a) 0.5
  • b) 1.2
  • c) 7.8
  • d) 9.8471


  • a) 0.5 is found by 1 divided by 2. Therefore 0.5 is RATIONAL.
  • b) 1.2 is found by 6 divided by 5. Therefore 1.2 is RATIONAL.
  • c) 7.8 is found by 78 divided by 10. Therefore 7.8 is RATIONAL.
  • d) 9.847 is found by 9847 divided by 1000. Therefore 9.847 is RATIONAL.

Ok, now the hard to understand part.

Notice what I did with the last one, d). I just took 9847 and divided it by 1000. That looks really cheap. Its almost like cheating.

In fact, I can do that with any decimal number that you can write down on paper.

1.1155 is just 11155 divided by 10000. Therefore 1.1155 is a RATIONAL NUMBER, because it can be found by dividing 2 INTEGERS together.

84.287158 is just 84,287,158 divided by 1,000,000. Therefore 84.287158 is a RATIONAL NUMBER, because it can be found by dividing 2 INTEGERS together.

1.1 is just 11 divided by 10. Therefore, 1.1 is a RATIONAL NUMBER, because it can be found by dividing 2 INTEGERS together.

Ok, ok. We know what a RATIONAL number is. But I have a question. What about numbers that repeat forever, like this:

  • a) 0.6666666666 (6’s repeat after the decimal forever)
  • b) 0.3333333333 (3’s repeat after the decimal forever)
  • c) 0.099099099 (099 repeats forever)

Are these RATIONAL NUMBERS? (Remember, a RATIONAL NUMBER is any decimal number that can be found by dividing two INTEGERS together).

Here are the answers:

  • a) 0.6666666666 can be found by dividing 2 by 3: Therefore 0.66666666 is a RATIONAL NUMBER
  • b) 0.3333333333 can be found by dividing 1 by 3: Therefore 0.3333333333 is a RATIONAL NUMBER
  • c) 0.099099099 can be found by dividing 11 by 111: Therefore 0.099099099 is a RATIONAL NUMBER

So far, we have discovered TWO TYPES of RATIONAL NUMBERS:

  1. The type that has a decimal value, then terminates
    • such as 0.1, 0.5, and 0.89
  2. The type that has a decimal value that repeats a pattern forever
    • such as 0.6666666666 [found by 2/3], 0.33333333333 [found by 1/3], and 0.099099099099099 [found by 11/111]

So does that mean that ANY DECIMAL NUMBER can be found by dividing 2 INTEGERS together???

ALMOST, but not quite. There is ANOTHER type of number called an IRRATIONAL NUMBER. We’ll explain that next.


OK, so we know what a RATIONAL NUMBER is now. A RATIONAL NUMBER is just any REAL NUMBER that can be found by dividing two INTEGERS together.

But, try this in your calculator:

  • SQUARE ROOT of 2
  • SQUARE ROOT of 5

When I punch those into my calculator, I get:

  • SQUARE ROOT of 2 is found to be 1.414213562 (then it stops showing decimals, but it WOULD keep going if it had the space. Yours might cut off earlier.)
  • SQUARE ROOT of 5 is found to be 2.236067978 (then it stops showing decimals)

Both the SQUARE ROOT of 2 and the SQUARE ROOT of 5 are called IRRATIONAL NUMBERS. IRRATIONAL NUMBERS are numbers that, no matter how hard you try, you CAN’T CALCULATE THEM BY DIVIDING TWO INTEGERS TOGETHER.

Now you MIGHT think, “well, I can find out the SQUARE ROOT of 2 dividing two integers! I can do:

1,414,213,562 / 1,000,000,000 = 1.414213562

Actually that is WRONG!! Using a better calculator to find SQUARE ROOT of 2, we would get 1.4142135623730950488016887242097. The SQUARE ROOT of 2 has decimal values that GO ON FOREVER, with NO REPEATING PATTERN, so therefore, the SQUARE ROOT of 2 is an IRRATIONAL NUMBER. The SQUARE ROOT of 2 can NEVER be FULLY found out by dividing ANY two INTEGERS together. You always have to go for that SQUARE ROOT button on your calculator to find the true value of the SQUARE ROOT of 2.

If you have 2 points, for example:

P( 2, 1 ); Q( 5, 7 )

You can find the linear equation of the line that passes through those points in the form:

Ax + By + C = 0

in one step by simply using the formula:

(y1 – y2)x + (x2 – x1)y + (x1y2 – x2y1) = 0

OR, we can write this as (easier to read!)
(py – qy)x + (qx – px)y + (pxqy – qxpy) = 0

Let’s try it:

Take Point1=( 2, 1 )
Take Point2=( 5, 7 )

Find the LINEAR EQUATION of the line that passes through the points (2,1) and (5,7). Your answer must be in the form of Ax + By + C = 0.

Using the equation:
(y1 – y2)x + (x2 – x1)y + (x1y2 – x2y1) = 0

We’ll just plug numbers in:
(1 – 7)x + (5 – 2)y + ( (2 x 7) – (5 x 1) ) = 0
-6x + 3y + (14 – 5) = 0
-6x + 3y + 9 = 0

Factoring a -3 out:
-3( 2x – y – 3 ) = 0

Dividing both sides by -3:
2x – y – 3 = 0

And that’s the answer.

That’s hella shorter than having to go through and do it using y = mx + b, and its a systematic way to do it in a computer in case m is infinity.

Formula from Peter Shirley’s CG book

Here’s a handbook of mathematical functions

James Avro’s amazon reviews

4 different notations for the derivative.

I’m pretty pissed off about that last one. We used each of those types in engineering, but nobody explained their origins or anything about them. All they said was “this means the derivative too.” wtf?? Why didn’t they say “this was Euclid’s way of writing the derivative”, or “this was Leibniz, and this is why he wrote the derivative this way.

I remember being confused about these different notations and I hated Leibniz notation.

However, now I PREFER Leibniz’s notation because of the idea of the infinitesimal.

Say y = ex and x = cos(W). Then, if we were to find:


This would be equal to

dy   dy    dx
-- = -- * --
dW   dx    dW

So you can see its equal visually because the dx’s cancel.

I remember being told that this was something ‘only of a coincidence’, and “they don’t really cancel”.

However, I think Leibniz meant that they did actually cancel, because he saw dx as an infinitesimally small amount.

The idea of the infinitesimal was rejected by mathematicians and apparently replaced by the (more “rigorous”) Epsilon Delta crap that we take in school today.

In the first Calculus course I took, nothing was explained. All they said was “If you have an epsilon, then you have a delta”. It made absolutely no sense. The only way we got marks in that course was by memorizing, not by really understanding.

Why didn’t they talk about the infinitesimal and explain WHY its not used, instead of just totally avoiding it? Its a good concept.

I have a huge bone to pick with Kuipers.

“We shall distinguish between two perspectives on rotations in the plane, and shall determine the effect which each has on coordinates of points in the plane. The first is rotation of the coordinate frame with respect to fixed points (vectors) in the plane; the second is rotation of points (vectors) with respect to a fixed coordinate frame.”

His writing suffers from the typical things that make an engineer’s / mathematicians writing harder to understand.

Can’t “we” just be clear?

There are two different types of planar rotation that we shall now discuss.

  1. A rotation of the actual coordinate frame with respect to fixed points in the plane.
  2. A rotation of the points with respect to a fixed coordinate frame.

The way I have written it is at least twice as fast to read, by my estimation. My criticisms are as follows:

– We know points are vectors, no need to slow us down with the parenthesis
– Use paragraphs more wisely. There was a need for a paragraph break as I have demonstrated.
– Removed the entire sentence “We shall determine the effect that each type of rotation has on the coordinates of points in the plane.” because the reader doesn’t care what you’re going to do with them yet. He’ll find out soon enough. Unless he sleeps. Let them have some degree of suspense, Kuipers.

Reading Kuipers’ writing is like trudging through a park with leaden shoes. The things he has to show you are very nice, but its the stifling formality of his writing that holds one back from enjoying the experience.

Originally I was going to try to write about where the transcendental number e comes from, but other people already have written a very good article about the origins of e.

Here’s a simple question with a simple answer.

From grade 6 you know:

c = pi*d

But where the did they get this number pi?

pi = c / d

It comes from experiment.

A teacher once told me that the way we know anything at all about our world is by experiment. All science comes from experiment. We experiment, then we form theories to explain the results we got from experimentation.

So here’s an experiment to explain pi:

Take any DVD and use a tape measure to measure its circumference.
Then measure the diameter of that DVD (width across its widest part).

We get:

circumference = 38cm
diameter = 12cm

Then, use a calculator and divide.

pi = 38/12 = 3.166666 . . . close enough to 3.14159 —

And that’s the origin of PI. It comes from any circle, anywhere in the universe that is perfectly round.

Mathematicians are very precise.

They name things very precisely.

They spend years and years formulating theories, and in the end, they have this rigorous (and very nasty) thing to present to the world and other mathematicians.

They also have a habit of naming everything.

One thing that I’ve found confusing is the reason for use of the word ‘transcendental’ when talking about trigonometry, or more confusingly, the number e.

The number e is called a “transcendental number”. Why?

In common English, the word “transcendental” means:

Beyond the relm and reach of the senses (i.e., something you simply can’t fully “get” or “grasp”) (sound like the right way to describe the number ‘e’?)
Non-natural (in the ‘supernatural’ sense) – existing outside of or not in accordance with (the nature we know)

I was reading Quaternions and Rotation Sequences.

The second paragraph says:

Historians of mathematics are generally agreed that…three highly significant developments occurred during the nineteenth century. These were:

  1. the development of non-Euclidean geomery,
  2. [the development] of a non-commutative algebra,
  3. and [the development] of a precise theoretical foundation for calculus.

Wait a minute . . . WTF is “Euclidean Geometry”, exactly? At first blush, I didn’t recognize that Euclidean Geometry is really what you learned in high school. They never call it that though! They just call it ‘algebra’. I can’t believe I didn’t actually know (or remember . . . ? ) that Euclidean Geometry __IS__ what fills algebra texts in schools today.

What of the original text from which Euclidean Geometry comes from? Still exists. Not read today by most, though. From Wikipedia:

“Not until the 20th century, by which time its content was universally taught through school books, did it cease to be considered something all educated people had read.”


some more notes

There are so many resources that have headlines that promise to solve the problem, but they actually don’t, because they’re eah.

eah quaternion resource 1