Foundation Maths For Remote Sensing and Spatial Ecology: The Purpose of These Notes
Foundation Maths For Remote Sensing and Spatial Ecology: The Purpose of These Notes
Remote sensing and spatial ecology are scientific disciplines and as such a reasonable
knowledge of mathematics is essential.
However, these days a wide variety of different university disciplines use spatial
techniques; including several departments that probably dont rate mathematics very
high as a prerequisite for undergraduates.
The information contained in these notes is not examinable but the student is
recommended to look at them, try the exercises, and ask questions!
When reading these notes, please try to remember that mathematics is a tool, much
like a drill.
Its very difficult to do home improvement without using a drill, so you use it; but you
might not necessarily know what makes it work.
In remote sensing and spatial ecology, we use the mathematics as a tool, we learn the
tricks and rules to use it correctly, but in many cases we dont need to know how it
works; only that it does.
These notes aim to describe the rules, tricks, and the tools of mathematics and we are
going to do a home mathematical improvement of a general research project.
1
Contents
Introduction..3
Planning a Scientific Project..4
Project Safety.....5
Materials...6
Numbers.....7
Functions....7
Vectors...9
Matrices..11
2
Introduction
y = 2 Z + 4 PQ 2
n =1
C = A B
a =b4
5x
y= x + 2x 2
3
y = mx + c
3
Planning a Scientific Project
Spatial projects can be satisfying, especially when your hard work pays off, but to
fully understand the processes you require more than the ability to display the
occasional image. As with all projects, whether we talk about science or home
improvement, expertise on specific tools is not as important when compared to
attention to details and learning quick and easy methods to do complicated tasks.
Now, what do you do at the start of a new scientific project? Well, begin any project
by writing your ideas down. Next, check both the available literature and the Internet
to determine whether your idea is novel or has been done before. Finally, try and
explain your idea to your colleagues. If they can follow and understand what you
mean; then you also understand what you are trying to achieve.
Now, that you are ready to begin, ask yourself the following questions:
What Types of Materials Would Work Best for My Project? In spatial projects
people frequently either use vector or raster (pixel) based data what will you need?
Does you analysis require integers (i.e. 1, 45, -10, 100) or real numbers (i.e. 2.23.
1.90, 100.8)? Do you need to use functions or Boolean algebra? Will you be using
satellite images (i.e. Matrices/Arrays) or point (e.g. Lidar) data?
Which Tools do I Need? Most spatial analysis packages allow the use of Boolean
operators will you need them? Do you need to integrate or differentiate anything?
If you are doing image processing, do you need to use Fourier Transforms or Matrix
Algebra? Will your analysis require the use of probability and statistics?
Do I have time to Learn or Use the Mathematics? If you are a graduate student,
you are probably very busy on research and course work. If you think you will need to
use a mathematical tool once, just learn the trick. Only try and understand the
processes involved if you need to use the mathematics again and again.
Have any Previous Studies Found a Shortcut? It is quite possible that a similar
study has written a program, or produced easy ways to do what you propose. Make
sure you have extensively checked the past resources and in particular google.
Can You Get By Using a Software Program? Many software packages (i.e. R,
SPSS, S-PLUS, MATLab, etc) are very powerful and can be used to help you in your
mathematical task. The most important thing that you must remember is to never use
Excel for statistics.
4
Project Safety
You might ask yourself, Safety in Mathematics? However, this is not a joke.
When conducting scientific projects you will use mathematics for a large variety of
tasks, some of which might involve human impacts. For instance, you might be
estimating the fuel required to make a boat trip to a remote field site. Making an error
in your calculation could prove dangerous.
However, it is more likely that by making errors you will just waste time. This is
something you cant afford to do in remote sensing as some processes can easily take
you a day to run. If you make a mathematical mistake, you will feel terrible the next
day, when you have to repeat the process. You might also feel uncertain that even this
process is correct. Such uncertainties are best avoided in graduate studies.
Now, you will make some mistakes, but the best you can do is to minimize the
number of times they occur. This can be done by always following these steps:
Original Backup The most important from of mathematical first aid that you can
have is to save your original unprocessed data backed up as a separate file that you
NEVER change.
Before doing any analysis, create an exact copy of this data, then work with the copy.
In the situation of complete meltdown in your analysis, a computer crash, etc, you can
always refer back to your original data.
Textbooks and Notes Always have your textbooks or notes handy. Quickly referring
to your notes, can not only save time later, but also will also give you more
confidence in your analysis and make the task less daunting.
Keep your Tools Handy Know where your calculator and software tools hide.
5
Materials
Numbers....7
Functions...7
Vectors...9
Matrices...11
y = 2 Z + 4 PQ 2
n =1
C = A B
a =b4
5x
y= x + 2x 2
3
y = mx + c
6
Numbers
The simplest material in mathematics is the Number. This is to mathematics like
wood is to carpentry and stone is to masonry.
However, numbers can come in many different shapes and forms. This section will
explain the differences of those that you will come across in remote sensing:
Integers These are numbers that have no decimal point and are sometimes called
Whole numbers. Integers can be negative, zero, or positive: -12, 45, 0, 22, -100
Natural These are like integers, except they do not include the negative numbers: 0,
34, 97, 1
Real Numbers or Floats These are numbers that are like integers but do have
decimal points: -32.4, 0.0, 19.78, 100.2
Rational Numbers of Fractions These are numbers that can be written as p/q, where
q 0: , , Numbers that cannot be written as p/q are called irrational numbers:
2 and are two such examples.
Functions
A function is a rule, which if you give it a specific input it will produce a specific
output.
For instance, lets assume that you are prefect at drilling a screw into a piece of wood.
In this example the function would look something like:
A function that you will probably see a lot in science is the function for a straight line.
It says that if you know:
1. The value of X,
2. How steep the slope of
the line is, and
3. Where the line intercepts
the Y-axis
7
The Language of Functions
f(x) = 3x
Now, if you saw the following line in the literature: f(x=3) or f(3) this means that the
person who wrote the line wants you to consider the case when x=3 and to work out
the answer for x =3. In our example, this would be 9. i.e f(3) = 9.
Examples:
(a) f(5)
(b) f(0)
(c) f(-2)
(d) f(b)
(e) f(t+1)
Note from (d) and (e) that it is the RULE that is important and not the letter used. i.e.
to drill in a screw, you could use several different types of screw heads and bit types,
but the rule and result is still the same.
Answers:
(a) y(4)
(b) y(x)
Answers:
(A + B) x (C + D) = (A x C) + (B x C) + (B x D) + (D x A)
8
Vectors
In all fields of science, including ecological applications, you will frequently make
use of measures that are simply described by a single number. Examples include:
In contrast, there exist several measurements that rely on the knowledge of the
direction that the object is pointing, moving, or has come from. These measures are
called vector quantities or more simply vectors.
When dealing with spatial ecology or GIS problems, you might be more used to
seeing vectors as line segments that stretch between two points:
Let us use the simplest example of wanting to add two line segments together:
a+b
a + =
b a b
The simplest approach is to draw a triangle, where the end of one vector touches the
start of the other.
9
As we are essentially dealing with triangles, several RULES when using vectors can
be stated:
The Commutative RULE: (It doesnt matter which one you add to the other)
a+b
b a =
a b
a+b
a+b=b+a
The Associative RULE: (You can repeat the commutative law with as many vectors
as you want)
a + (b + c) = (a + b) + c
(-a)
b
(-a) + = b-a
a = b
-
b
The Multiplying by a Scalar RULES: (Just like regular mathematics: p and q are
scalars and a and b are vectors)
q.(p.a) = (q.p).a
10
Matrices
The most common matrices in remote sensing are IMAGES and SPECTRA.
1 2 2 2 5
1 1 1 2 3 4 2 6
2
A = 1 8 1 B = (1 2 2 1) X = P = 1 2 2 2 1
1
1 1 1 1 2 2 2 2
5
4 2 2 3
There exist several useful RULES when working with matrices. The complete
collection of rules is sometimes called Matrix Algebra. The RULES of matrix
algebra are classic examples of things you should know, but not care how they
work.
Addition and subtraction If two matrices have the same shape and size then the
elements in each matrix can be added or subtracted:
Addition RULE:
A B A Z Z X A+ Z B+Z A+ X
B A A + X X Y = B+ X A+ X A+Y
B C C Y Z B + Y C +Y C Z
Y
Subtraction RULE:
(A B C D ) (W X Y Z ) = (A W B X C Y DZ)
Multiplication There are two types of matrix multiplication: One is easy and the
other is bizarre.
A * (X Y Z ) = (A * X A *Y A* Z )
11
Bizarre RULE (Multiply two matrices together):
a11 a12 b11 b12 a11b11 + a12 b21 a11b12 + a12 b22
* =
a21 a22 b21 b22 a21b11 + a22 b21 a 21b12 + a 22 b22
Examples:
(a) 1 1 4 5 1 + 4 1+ 5 5 6
+ = =
2 2 2 3 2 + ( 2) 2 + 3 0 5
(b) 1 1 4 5 1 4 1 5 3 4
= =
2 2 2 3 2 ( 2) 2 3 4 1
1 1 4 5 (1 * 4) + (1 * 2) (1 * 5) + (1 * 3) 2 8
(c) * = =
2 2 2 3 ( 2 * 4) + ( 2 * 2) ( 2 * 5) + ( 2 * 3) 4 16
1
1 2 3 (1 * 1) + ( 2 * 2) + (3 * 4) 17
(d) * 2 = =
4 5 6 4 (1 * 4 ) + ( 2 * 5) + ( 4 * 6 ) 36
2 2 1
(e)
3 3 * 2 = CANT BE DONE
1 1 3
The last example is not possible, as the q r. i.e. the number of columns in the first
matrix (2) does not equal the number of rows in the second matrix (3).
12
Tools and Skills
Differentiation....14
Integration.17
y = 2 Z + 4 PQ 2
n =1
C = A B
a =b4
5x
y= x + 2x 2
3
y = mx + c
13
Differentiation
Differentiation is a mathematical technique that is used to assess how functions
change. i.e. this is the change sensor (be that movement, rain, temperature, etc) of
mathematics.
In particular, differentiation assess how rapidly that the function is changing at any
specific point. i.e. if we are looking at a function changing with time, differentiation
assesses the RATE that the function changes.
In remote sensing and spatial ecology we typically use differentiation in two ways:
either in image processing to detect edges or in spectral processing to detect features.
Y = 2 for x>0
Y = 1 for x<0 X=0
The step function is an edge
in 1 dimension.
14
This process of measuring the gradients of very small pieces of line is differentiation.
To calculate the gradient (or derivative) of a small piece of line you use the following
equation:
y 2 y1 small change in y dy
Gradient = = =
x2 x1 small change in x dx
The value of the gradient can vary from 0 (which is a flat line) to infinity (for a
vertical line). A line with an angle of 45 has a gradient of 1.
dy
For y = cons; =0
dx
dy
For y = xn; = nx n 1
dx
dy 1
For y = ln x; =
dx x
dy
For y = e ax ; = ae ax
dx
dy
For y = sin( ax + b); = a cos( ax + b)
dx
dy
For y = cos( ax + b); = a sin( ax + b)
dx
15
Examples:
(a) y = x
In this example, if x changes by 1 then y should also change by 1; i.e. the rate
of change with 1 unit of y is 1. We would then expect that the derivative
should also equal 1:
dy
Answer: For y = x; = (n = 1) * x ( n= 0) = 1
dx
(b) y = x5 + 2x + 4
dy
For y = x 5 ; = ( n = 5) * x ( n = 4 ) = 5 x 4
dx
dy
For y = 2x; = ( n = 1) * 2 x ( n = 0 ) = 2
dx
dy
For y = 4; =0
dx
16
Integration
The process of integration allows us to calculate the area underneath a curve. Such an
area can have several interpretations. For example:
The area under a graph showing the power of a drill with time will tell us the total
energy used by the drill (as Energy = Power x Time).
Example #1
1
Now the area underneath this line
0.9
can be calculated by either
integration or using simple 0.8
trigonometry. 0.7
Power (Watts)
0.6
Trig: The area of a triangle = x
Base x Height = x 1 x 1 = . 0.5
0.4
0.3
Integration: 0.2
as follows: 0
0 0.2 0.4 0.6 0.8 1
You increase the power by one and then divide the answer by this new number,
finally you add a constant C.
Often the integral is between two values (e.g. in this case we are trying to add up the
area under the curve between 0 and 1). When this happens you dont need to worry
about C
In these cases, first calculate the values you would get by putting those end x values
(i.e. 0 and 1) into the answer. Second, subtract the smaller x values answer (i.e using
x=0) from the larger x values answer (using x=1):
1 1 1 1 1
Area = xdx = ( x = 1) 2 ( x = 0) 2 = 0 =
0 2 2 2 2
This is integration. Note that the answer is identical to the trig method.
17
Integration is all about following a rule, like the one explained about and then
subtracting the smaller x answer from the larger x answer.
Expressions Integral
1/x = ln |x| + C
eax = (eax/a) + C
There are many more, but only these are of interest in this course.
Example
Imagine that our drill is now working twice as hard in the same time interval (i.e. 0 to
1) such that now y=2x. Calculate the energy by each method.
Integration:
1 1 1
Area = 2 xdx = 2 ( x = 1) ( x = 0) 2 = 1 0 = 1
2
0 2
The second RULE of integration is that when the integral sign has numbers at the top
and bottom you:
3
3 1 1 1 9 1
1
xdx = x 2 = ( x = 3) 2 ( x = 1) 2 = = 4
2 1 2 2 2 2
18
For a more complicated example, the following graph shows a sine function:
1.5
Y=sin(x)
1
0.5
0
-3 -2 -1 0 1 2 3
-0.5 Units of Pi ()
-1
-1.5
In this example, we want to calculate the area under the curve between 1 and +1.
This should be Zero, as each curve above and below the line is the same size.
However, lets work this out using the sin(ax+b) rule mentioned in the previous page.
Therefore:
1 1
Area = sin xdx = 1 cos( x = ) 1 cos( x = ) = 1 1 = 0
The integration of sines and cosines are very important for the theory behind remote
sensing and image processing.
19