Monday, 8 February 2016

What is a function

What is a Function?

A function relates an input to an output.
It is like a machine that has an input and an output.
And the output is related somehow to the input.

  f(x)   "f(x) = ... " is the classic way of writing a function.
And there are other ways, as you will see!

Input, Relationship, Output

We will see many ways to think about functions, but there are always three main parts:
  • The input
  • The relationship
  • The output

Example: "Multiply by 2" is a very simple function.

Here are the three parts:
Input Relationship Output
0 × 2 0
1 × 2 2
7 × 2 14
10 × 2 20
... ... ...
For an input of 50, what is the output?

Some Examples of Functions

  • x2 (squaring) is a function
  • x3+1 is also a function
  • Sine, Cosine and Tangent are functions used in trigonometry
  • and there are lots more!
But we are not going to look at specific functions ...
... instead we will look at the general idea of a function.

Names

First, it is useful to give a function a name.
The most common name is "f", but we can have other names like "g" ... or even "marmalade" if we want.
But let's use "f":
f(x)
We say "f of x equals x squared"
what goes into the function is put inside parentheses () after the name of the function:
So f(x) shows us the function is called "f", and "x" goes in
And we usually see what a function does with the input:
f(x) = x2 shows us that function "f" takes "x" and squares it.

Example: with f(x) = x2:
  • an input of 4
  • becomes an output of 16.
In fact we can write f(4) = 16.

The "x" is Just a Place-Holder!

Don't get too concerned about "x", it is just there to show us where the input goes and what happens to it.
It could be anything!
So this function:
f(x) = 1 - x + x2
Is the same function as:
  • f(q) = 1 - q + q2
  • h(A) = 1 - A + A2
  • w(θ) = 1 - θ + θ2
The variable (x, q, A, etc) is just there so we know where to put the values:
f(2) = 1 - 2 + 22 = 3

Sometimes There is No Function Name

Sometimes a function has no name, and we see something like:
y = x2
But there is still:
  • an input (x)
  • a relationship (squaring)
  • and an output (y)

Relating

At the top we said that a function was like a machine. But a function doesn't really have belts or cogs or any moving parts - and it doesn't actually destroy what we put into it!
A function relates an input to an output.
Saying "f(4) = 16" is like saying 4 is somehow related to 16. Or 4 → 16
Example: this tree grows 20 cm every year, so the height of the tree is related to its age using the function h:
h(age) = age × 20
So, if the age is 10 years, the height is:
h(10) = 10 × 20 = 200 cm
Here are some example values:
age h(age) = age × 20
0 0
1 20
3.2 64
15 300
... ...

What Types of Things Do Functions Process?

"Numbers" seems an obvious answer, but ...

... which numbers?
For example, the tree-height function h(age) = age×20 makes no sense for an age less than zero.
... it could also be letters ("A"→"B"), or ID codes ("A6309"→"Pass") or stranger things.
So we need something more powerful, and that is where sets come in:

A set is a collection of things.

Here are some examples:
Set of even numbers: {..., -4, -2, 0, 2, 4, ...}
Set of clothes: {"hat","shirt",...}
Set of prime numbers: {2, 3, 5, 7, 11, 13, 17, ...}
Positive multiples of 3 that are less than 10: {3, 6, 9}
Each individual thing in the set (such as "4" or "hat") is called a member, or element.
So, a function takes elements of a set, and gives back elements of a set.

A Function is Special

But a function has special rules:
  • It must work for every possible input value
  • And it has only one relationship for each input value
This can be said in one definition:

Formal Definition of a Function

A function relates each element of a set
with exactly one element of another set
(possibly the same set).

The Two Important Things!

1.
"...each element..." means that every element in X is related to some element in Y.
We say that the function covers X (relates every element of it).
(But some elements of Y might not be related to at all, which is fine.)
2.
"...exactly one..." means that a function is single valued. It will not give back 2 or more results for the same input.
So "f(2) = 7 or 9" is not right!
Note: "One-to-many" is not allowed, but "many-to-one" is allowed:
function   function
(one-to-many)   (many-to-one)
This is NOT OK in a function   But this is OK in a function
When a relationship does not follow those two rules then it is not a function ... it is still a relationship, just not a function.

Example: The relationship x → x2

function
Could also be written as a table:
X: x Y: x2
3 9
1 1
0 0
4 16
-4 16
... ...

It is a function, because:
  • Every element in X is related to Y
  • No element in X has two or more relationships
So it follows the rules.
(Notice how both 4 and -4 relate to 16, which is allowed.)

Example: This relationship is not a function:

function
It is a relationship, but it is not a function, for these reasons:
  • Value "3" in X has no relation in Y
  • Value "4" in X has no relation in Y
  • Value "5" is related to more than one value in Y
(But the fact that "6" in Y has no relationship does not matter)

not single valued

Vertical Line Test

On a graph, the idea of single valued means that no vertical line ever crosses more than one value.
If it crosses more than once it is still a valid curve, but is not a function.

Some types of functions have stricter rules, to find out more you can read Injective, Surjective and Bijective

Infinitely Many

My examples have just a few values, but functions usually work on sets with infinitely many elements.

Example: y = x3

  • The input set "X" is all Real Numbers
  • The output set "Y" is also all the Real Numbers
We can't show ALL the values, so here are just a few examples:
X: x Y: x3
-2 -8
-0.1 -0.001
0 0
1.1 1.331
3 27
and so on... and so on...

Domain, Codomain and Range

In our examples above
  • the set "X" is called the Domain,
  • the set "Y" is called the Codomain, and
  • the set of elements that get pointed to in Y (the actual values produced by the function) is called the Range.
We have a special page on Domain, Range and Codomain if you want to know more.

So Many Names!

Functions have been used in mathematics for a very long time, and lots of different names and ways of writing functions have come about.
Here are some common terms you should get familiar with:
Function Parts
Example: with z = 2u3:
  • "u" could be called the "independent variable"
  • "z" could be called the "dependent variable" (it depends on the value of u)
Example: with f(4) = 16:
  • "4" could be called the "argument"
  • "16" could be called the "value of the function"

Ordered Pairs

And here is another way to think about functions:
Write the input and output of a function as an "ordered pair", such as (4,16).
They are called ordered pairs because the input always comes first, and the output second:
(input, output)
So it looks like this:
( x, f(x) )
Example:
(4,16) means that the function takes in "4" and gives out "16"

Set of Ordered Pairs

A function can then be defined as a set of ordered pairs:
Example: {(2,4), (3,5), (7,3)} is a function that says
"2 is related to 4", "3 is related to 5" and "7 is related 3".
Also, notice that:
  • the domain is {2,3,7} (the input values)
  • and the range is {4,5,3} (the output values)
But the function has to be single valued, so we also say
"if it contains (a, b) and (a, c), then b must equal c"
Which is just a way of saying that an input of "a" cannot produce two different results.
Example: {(2,4), (2,5), (7,3)} is not a function because {2,4} and {2,5} means that 2 could be related to 4 or 5.
In other words it is not a function because it is not single valued

 

interactive-cartesian-coordinates  

A Benefit of Ordered Pairs

We can graph them...
... because they are also coordinates!
So a set of coordinates is also a function (if they follow
the rules above, that is)

 

A Function Can be in Pieces

We can create functions that behave differently depending on the input value

Example: A function with two pieces:

  • when x is less than 0, it gives 5,
  • when x is 0 or more it gives x2
Piecewise Function Here are some example values:
x y
-3 5
-1 5
0 0
2 4
4 16
... ...
Read more at Piecewise Functions.

Explicit vs Implicit

One last topic: the terms "explicit" and "implicit".
"Explicit" is when the function shows us how to go directly from x to y, such as:
y = x3 - 3
When we know x, we can find y
That is the classic y = f(x) style.
"Implicit" is when it is not given directly such as:
x2 - 3xy + y3 = 0
When we know x, how do we find y?
It may be hard (or impossible!) to go directly from x to y.

Monday, 9 November 2015

Quadratic Equations

Quadratic Equations



Name

The name Quadratic comes from "quad" meaning square, because the variable gets squared (like x2).
It is also called an "Equation of Degree 2" (because of the "2" on the x)

Standard Form

The Standard Form of a Quadratic Equation looks like this:
Quadratic Equation
  • a, b and c are known values. a can't be 0.
  • "x" is the variable or unknown (we don't know it yet).
Here are some more examples:
2x2 + 5x + 3 = 0   In this one a=2, b=5 and c=3
     
x2 − 3x = 0   This one is a little more tricky:
  • Where is a? Well a=1, and we don't usually write "1x2"
  • b = -3
  • And where is c? Well c=0, so is not shown.
5x − 3 = 0   Oops! This one is not a quadratic equation: it is missing x2
(in other words a=0, which means it can't be quadratic)

Hidden Quadratic Equations!

So the "Standard Form" of a Quadratic Equation is
ax2 + bx + c = 0
But sometimes a quadratic equation doesn't look like that! For example:
In disguise In Standard Form a, b and c
x2 = 3x -1 Move all terms to left hand side x2 - 3x + 1 = 0 a=1, b=-3, c=1
2(w2 - 2w) = 5 Expand (undo the brackets),
and move 5 to left
2w2 - 4w - 5 = 0 a=2, b=-4, c=-5
z(z-1) = 3 Expand, and move 3 to left z2 - z - 3 = 0 a=1, b=-1, c=-3
5 + 1/x - 1/x2 = 0 Multiply by x2
5x2 + x - 1 = 0 a=5, b=1, c=-1

Quadratic Graph  

Have a Play With It

Play with the "Quadratic Equation Explorer" so you can see:
  • the graph it makes, and
  • the solutions (called "roots").

How To Solve It?

The "solutions" to the Quadratic Equation are where it is equal to zero.
There are usually 2 solutions (as shown in the graph above).
They are also called "roots", or sometimes "zeros"
There are 3 ways to find the solutions:
1. We can Factor the Quadratic (find what to multiply to make the Quadratic Equation)
2. We can Complete the Square, or
3. We can use the special Quadratic Formula:
Quadratic Formula
Just plug in the values of a, b and c, and do the calculations.
We will look at this method in more detail now.
.

Discriminant

Do you see b2 - 4ac in the formula above? It is called the Discriminant, because it can "discriminate" between the possible types of answer:
  • when b2 - 4ac is positive, we get two Real solutions
  • when it is zero we get just ONE real solution (both answers are the same)
  • when it is negative we get two Complex solutions
Complex solutions? Let's talk about them after we see how to use the formula.


Example: Solve 5x² + 6x + 1 = 0

Coefficients are:   a = 5, b = 6, c = 1
     
Quadratic Formula:   x = [ −b ± √(b2 − 4ac) ] / 2a
     
Put in a, b and c:   x = [ −6 ± √(62 − 4×5×1) ] / (2×5)
     
Solve:   x = [ −6 ± √(36−20) ]/10
    x = [ −6 ± √(16) ]/10
    x = ( −6 ± 4 )/10
    x = −0.2 or −1

5x^2+6x+1
Answer: x = -0.2 or x = -1

And we see them on this graph.

Check -0.2: 5×(-0.2)² + 6×(-0.2) + 1
= 5×(0.04) + 6×(-0.2) + 1
= 0.2 -1.2 + 1
= 0
Check -1: 5×(-1)² + 6×(-1) + 1
= 5×(1) + 6×(-1) + 1
= 5 - 6 + 1
= 0


Complex Solutions?

When the Discriminant (the value b2 - 4ac) is negative we get Complex solutions ... what does that mean?
It means our answer will include Imaginary Numbers. Wow!

Example: Solve 5x² + 2x + 1 = 0

Coefficients are:   a = 5, b = 2, c = 1
     
Note that The Discriminant is negative:   b2 - 4ac = 22 - 4×5×1 = -16
     
Use the Quadratic Formula:   x = [ -2 ± √(-16) ] / 10
     
The square root of -16 is 4i
(i is √-1, read Imaginary Numbers to find out more)
     
So:   x = ( -2 ± 4i )/10
5x^2+6x+1
Answer: x = -0.2 ± 0.4i

The graph does not cross the x-axis. That is why we ended up with complex numbers.
In some ways it is easier: we don't need more calculation, just leave it as -0.2 ± 0.4i.

Set

First we specify a common property among "things" (this word will be defined later) and then we gather up all the "things" that have this common property.
For example, the items you wear: shoes, socks, hat, shirt, pants, and so on.
I'm sure you could come up with at least a hundred.
This is known as a set.
Or another example is types of fingers.
This set includes index, middle, ring, and pinky.
 
So it is just things grouped together with a certain property in common.

Notation

There is a fairly simple notation for sets. We simply list each element (or "member") separated by a comma, and then put some curly brackets around the whole thing:
Set
The curly brackets { } are sometimes called "set brackets" or "braces".
This is the notation for the two previous examples:
{socks, shoes, watches, shirts, ...}
{index, middle, ring, pinky}
Notice how the first example has the "..." (three dots together).
The three dots ... are called an ellipsis, and mean "continue on".
So that means the first example continues on ... for infinity.
(OK, there isn't really an infinite amount of things you could wear, but I'm not entirely sure about that! After an hour of thinking of different things, I'm still not sure. So let's just say it is infinite for this example.)
So:
  • The first set {socks, shoes, watches, shirts, ...} we call an infinite set,
  • the second set {index, middle, ring, pinky} we call a finite set.
But sometimes the "..." can be used in the middle to save writing long lists:
Example: the set of letters:
{a, b, c, ..., x, y, z}
In this case it is a finite set (there are only 26 letters, right?)

Numerical Sets

So what does this have to do with mathematics? When we define a set, all we have to specify is a common characteristic. Who says we can't do so with numbers?
Set of even numbers: {..., -4, -2, 0, 2, 4, ...}
Set of odd numbers: {..., -3, -1, 1, 3, ...}
Set of prime numbers: {2, 3, 5, 7, 11, 13, 17, ...}
Positive multiples of 3 that are less than 10: {3, 6, 9}
And the list goes on. We can come up with all different types of sets.
There can also be sets of numbers that have no common property, they are just defined that way. For example:
{2, 3, 6, 828, 3839, 8827}
{4, 5, 6, 10, 21}
{2, 949, 48282, 42882959, 119484203}
Are all sets that I just randomly banged on my keyboard to produce.

Why are Sets Important?

Sets are the fundamental property of mathematics. Now as a word of warning, sets, by themselves, seem pretty pointless. But it's only when we apply sets in different situations do they become the powerful building block of mathematics that they are.
Math can get amazingly complicated quite fast. Graph Theory, Abstract Algebra, Real Analysis, Complex Analysis, Linear Algebra, Number Theory, and the list goes on. But there is one thing that all of these share in common: Sets.

Universal Set

  At the start we used the word "things" in quotes. We call this the universal set. It's a set that contains everything. Well, not exactly everything. Everything that is relevant to our question.
  Then our sets included integers. The universal set for that would be all the integers. In fact, when doing Number Theory, this is almost always what the universal set is, as Number Theory is simply the study of integers.
  However in Calculus (also known as real analysis), the universal set is almost always the real numbers. And in complex analysis, you guessed it, the universal set is the complex numbers.

Some More Notation

When talking about sets, it is fairly standard to use Capital Letters to represent the set, and lowercase letters to represent an element in that set.

So for example, A is a set, and a is an element in A. Same with B and b, and C and c.
Now you don't have to listen to the standard, you can use something like m to represent a set without breaking any mathematical laws (watch out, you can get π years in math jail for dividing by 0), but this notation is pretty nice and easy to follow, so why not?
Also, when we say an element a is in a set A, we use the symbol to show it.
And if something is not in a set use .
Example: Set A is {1,2,3}. We can see that 1 A, but 5 A

Equality

Two sets are equal if they have precisely the same members. Now, at first glance they may not seem equal, so we may have to examine them closely!
Example: Are A and B equal where:
  • A is the set whose members are the first four positive whole numbers
  • B = {4, 2, 1, 3}
Let's check. They both contain 1. They both contain 2. And 3, And 4. And we have checked every element of both sets, so: Yes, they are equal!
And the equals sign (=) is used to show equality, so we write:
A = B

Subsets

When we define a set, if we take pieces of that set, we can form what is called a subset.
So for example, we have the set {1, 2, 3, 4, 5}. A subset of this is {1, 2, 3}. Another subset is {3, 4} or even another, {1}. However, {1, 6} is not a subset, since it contains an element (6) which is not in the parent set. In general:
A is a subset of B if and only if every element of A is in B.
So let's use this definition in some examples.

Is A a subset of B, where A = {1, 3, 4} and B = {1, 4, 3, 2}?

1 is in A, and 1 is in B as well. So far so good.
3 is in A and 3 is also in B.
4 is in A, and 4 is in B.
That's all the elements of A, and every single one is in B, so we're done.
Yes, A is a subset of B
Note that 2 is in B, but 2 is not in A. But remember, that doesn't matter, we only look at the elements in A.
Let's try a harder example.

Example: Let A be all multiples of 4 and B be all multiples of 2. Is A a subset of B? And is B a subset of A?

Well, we can't check every element in these sets, because they have an infinite number of elements. So we need to get an idea of what the elements look like in each, and then compare them.
The sets are:
  • A = {..., -8, -4, 0, 4, 8, ...}
  • B = {..., -8, -6, -4, -2, 0, 2, 4, 6, 8, ...}
By pairing off members of the two sets, we can see that every member of A is also a member of B, but every member of B is not a member of A:

pairing off A and B
So:
A is a subset of B, but B is not a subset of A

Proper Subsets

If we look at the defintion of subsets and let our mind wander a bit, we come to a weird conclusion.
Let A be a set. Is every element in A an element in A? (Yes, I wrote that correctly.)
Well, umm, yes of course, right?
So doesn't that mean that A is a subset of A?
This doesn't seem very proper, does it? We want our subsets to be proper. So we introduce (what else but) proper subsets.
A is a proper subset of B if and only if every element in A is also in B, and there exists at least one element in B that is not in A.
This little piece at the end is only there to make sure that A is not a proper subset of itself. Otherwise, a proper subset is exactly the same as a normal subset.

Example:

{1, 2, 3} is a subset of {1, 2, 3}, but is not a proper subset of {1, 2, 3}.

Example:

{1, 2, 3} is a proper subset of {1, 2, 3, 4} because the element 4 is not in the first set.
Notice that if A is a proper subset of B, then it is also a subset of B.

Even More Notation

When we say that A is a subset of B, we write A B.
Or we can say that A is not a subset of B by A B ("A is not a subset of B")
When we talk about proper subsets, we take out the line underneath and so it becomes A B or if we want to say the opposite, A B.

Empty (or Null) Set

This is probably the weirdest thing about sets.
As an example, think of the set of piano keys on a guitar.
"But wait!" you say, "There are no piano keys on a guitar!"
And right you are. It is a set with no elements.
This is known as the Empty Set (or Null Set).There aren't any elements in it. Not one. Zero.
It is represented by
Or by {} (a set with no elements)
Some other examples of the empty set are the set of countries south of the south pole.
So what's so weird about the empty set? Well, that part comes next.https://www.mathsisfun.com/sets/sets-introduction.html

Sunday, 8 November 2015

What is Trigonometry


triangle Trigonometry ... is all about triangles.

Right Angled Triangle

triangle showing Opposite, Adjacent and Hypotenuse
The triangle of most interest is the right-angled triangle.
The right angle is shown by the little box in the corner.
We usually know another angle θ.
And we give names to each side:
  • Adjacent is adjacent (next to) to the angle θ
  • Opposite is opposite the angle θ
  • the longest side is the Hypotenuse

"Sine, Cosine and Tangent"

Trigonometry is good at find a missing side or angle in a triangle.
The special functions Sine, Cosine and Tangenthelp us!
They are simply one side of a right-angled triangle divided by another.
For any angle "θ":
Right-Angled Triangle
Sine Function:
sin(θ) = Opposite / Hypotenuse
Cosine Function:
cos(θ) = Adjacent / Hypotenuse
Tangent Function:
tan(θ) = Opposite / Adjacent
(Sine, Cosine and Tangent are often abbreviated to sin, cos and tan.)

Example: What is the sine of 35°?

Using this triangle (lengths are only to one decimal place):
sin(35°) = Opposite / Hypotenuse = 2.8/4.9 = 0.57...
Calculators have sin, cos and tan, let's see how to use them:

Example: What is the missing length here?

  • We know the Hypotenuse
  • We want to know the Opposite
Sine is the ratio of Opposite / Hypotenuse
calculator-sin-cos-tan
Get a calculator, type in "45", then the "sin" key:
sin(45°) = 0.7071...
Now multiply by 20 (the Hypotenuse length):
Opposite length = 20 × 0.7071... = 14.14 (to 2 decimals)

Try Sin Cos and Tan!

Move the mouse around to see how different angles affect sine, cosine and tangent:
And you will also see why trigonometry is also about circles! In this animation the hypotenuse is 1, making the Unit Circle.
Notice that the sides can be positive or negative according to the rules of Cartesian coordinates. This makes the sine, cosine and tangent change between positive and negative also.

unit circle

Unit Circle

What you just played with is the Unit Circle.
It is a circle with a radius of 1 with its center at 0.
Because the radius is 1, we can directly measure sine, cosine and tangent.
Here we see the sine function being made by the unit circle:







You can also see the nice graphs made by sine, cosine and tangent.

Degrees and Radians

Angles can be in Degrees or Radians. Here are some examples:
Angle Degrees Radians
right angleRight Angle  90° π/2
__ Straight Angle 180° π
right angle Full Rotation 360° 2π

Repeating Pattern

Because the angle is rotating around and around the circle the Sine, Cosine and Tangent functions repeat once every full rotation (see Amplitude, Period, Phase Shift and Frequency).
When we need to calculate the function for an angle larger than a full rotation of 2π (360°) we subtract as many full rotations as needed to bring it back below 2π (360°):

Example: what is the cosine of 370°?

370° is greater than 360° so let us subtract 360°
370° − 360° = 10°
cos(370°) = cos(10°) = 0.985 (to 3 decimal places)
And when the angle is less than zero, just add full rotations.

Example: what is the sine of −3 radians?

−3 is less than 0 so let us add 2π radians
−3 + 2π = −3 + 6.283 = 3.283 radians
sin(−3) = sin(3.283) = −0.141 (to 3 decimal places)

Solving Triangles

A big part of Trigonometry is Solving Triangles. "Solving" means finding missing sides and angles.

Example: Find the Missing Angle "C"

Angle C can be found using angles of a triangle add to 180°:
So C = 180° − 76° − 34° = 70°
It is also possible to find missing side lengths and more. The general rule is:
When we know any 3 of the sides or angles we can find the other 3
(except for the three angles case)

See Solving Triangles for more details.

Other Functions (Cotangent, Secant, Cosecant)

Similar to Sine, Cosine and Tangent, there are three other trigonometric functions which are made by dividing one side by another:
Right-Angled Triangle
Cosecant Function:
csc(θ) = Hypotenuse / Opposite
Secant Function:
sec(θ) = Hypotenuse / Adjacent
Cotangent Function:
cot(θ) = Adjacent / Opposite

Trigonometric and Triangle Identities

And as you get better at Trigonometry you can learn these:
right angled triangle The Trigonometric Identities are equations that are true for all right-angled triangles.
triangle The Triangle Identities are equations that are true for all triangles (they don't have to have a right angle).