## Linear Functions

Aims:
1. In this chapter we will review the concept of a straight line, midpoint of two points, distance between two points, and gradient.
2. We will then derive an equation for the line.
3. We will then obtain linear expressions from different problems and
4. learn how to sketch a straight line.
1. A linear function is a function in which one variable increases (or decreases) at a constant rate when the other variable changes. These two variables are traditionally called x and y. You could use other names depending on circumstances and needs. See examples below.
2. Examples of linear functions:
1. the exchange rate between US dollar (USD) and HK dollar (HKD) on a particular day:
HKD = 7.8 ( USD )
2. the cost (C) of making X photo copies in the library where each copy costs $0.10. : C = 0.1 ( X ) 3. the cost of taking a taxi (y) where upon boarding a flat rate of$20.00 is charged and every additional kilometre is \$5.00. Let distance be measured by x in km:
y = 5 ( x ) + 20
4. the conversion between farenheit (f) and centigrade (c):
f = 1.8 ( c ) + 32
3. The above functions are called "linear" because they are straight lines when depicted on a cartesian plan.
4. Observe the above linear functions all have the common form of y = mx + c where m is called the gradient and c is a real number constant.
5. On a cartesian plan (two dimensional plan) a straight line connects any two points (x1, y1) and (x2, y2).
6. Midpoint of two points.
1. Look at the diagram at the side. A midpoint M seperates AB into two segments of equal length. Let us start by doing some explorations.
2. A horizontal line case 1: If we are given (0, 0) and (0, 6) then the midpoint M is obviously (0, 3). The x coordinate does not change because M must be on the horizontal line. 3 is half of (6-0).
3. A horizontal line case 2: If we are given (-1, 2) and (-1, 6) then the midpoint M is (-1, 4).
4. Given (-1, -2) and (-1, 6) then the midpoint M is (-1, 2) and NOT (-1,4) because the distance between these two points is (6-(-2)) 8 and half of this distance is 4. 4 units to the right of -2 is 2 (-2+4).
5. A vertical line case 1: If we are given (5, 0) and (10, 0) then the midpoint M is (7.5, 0). Y coordinate does not change because M must be on the vertical line. The vertical distance is 10-5 = 5. So half of the distance is 2.5 and 2.5 unit above 5 is 7.5.
6. A vertical line case 2: If we are given (5,2) and (10,2) then the midpoint M is (7.5, 2)
7.  Crucial Points: Given (x1, k) and (x2, k) where k is a constant then the midpoint M on this horizontal line is ( [x1+x2] / 2 , k ). Given (k, y1) and (k, y2) where k is a constant then the midpoint M on this vertical line is ( k , [y1+y2] / 2 ) The general case turns out to be a simple combination of the two rules above (refer to the diagram above). Given (x1, y1) and (x2,y2) the midpoint M is ( [x1 + x2] / 2 , [y1 + y2] / 2 ).
7. Distance between two points.
1. Look at the diagram above. We will notice that given any two points that lie neither on a vertical nor horizontal line that these points could be thought of as vertices (corners) of a right-angle triangle. The vertex that forms the right angle is simply (x1,y2). Distance AB then can be simply be found by applying the Pythagoras' Theorem.
AB 2 = (x2 - x1 )2 + ( y2- y1 )2. Thus,
AB = √[ (x2 - x1 )2 + ( y2- y1 )2 ],
and obviously you will only take the positive answer since the distance cannot be negative. Incidentally, the Pythagoras' Theorem is also applicable even if the two points happen to be on either the vertical or horizontal line.
2. Example 1: A(2, 5) and B(4, 9) then
AB = √[ (4 - 1 )2 + ( 9 - 5 )2 ]
= √( 32 + 42 )
= √(25)
= 5
3. Example 2: P(-1,-5) and Q(2, -10) then
AB = √[ (2 - (-1) )2 + ( -10 - (- 5) )2 ]
= √[ 32 + (-5)2 ]
= √34
1. The gradient is the "steepness" of the line. Again we can look at the diagram above for inspiration. If we have a horizontal line then we call the line flat which we mean to have no slope. So, the gradient of the horizontal line is zero. If the line is vertical then the concept of slope is not that meaningful. But if the line is near vertical then obviously the "steepness" is very big.
2. m = ( y2 - y1 ) / ( x2 - x1 ) captures the properties above. We can think of m as the change in rise over the change in run; or simply "rise over run".
3. L1 and L2 in the diagram at the side have positive gradients. L3 and L4 have negative gradients.
4. Example 1 (horizontal line): The slope of AB where A(2,8) and B(6,8) is
m = (8 - 8) / (6 - 2)
m = 0.
5. Example 2 (vertical line): The slope of CD where C(2, 4) and D(2, 8) is
m = (8 - 4) / (2 - 2)
m = 4/0 which is undefined. Basically, there is no sense of talking about "steepness" in this case.
6. Example 3 : The slope of EF where E(2,4) and F(6,10) is
m = (10 - 4 )/ (6 - 2)
m = 6/4
m = 3/2
7. Example 4 : The slope of GH where G(-6,8) and H(-4,-5) is
m = (-5 - 8)/ (-4 -(-6))
m = -13/2
9. Deriving the Linear Function y = mx + c.
1. Let us start by rearanging the gradient expession, m = (y2 - y1) / (x2 - x1).
y2 - y1 = m (x2 - x1)
Note that the equation holds for any pair of points. Let us rename one point as (x, y) then we can write
2. y - y1 = m (x - x1) ------------(1);
This expression (1) is especially useful for deriving the linear expression when we are given a specific point on the line and the gradient.
3. y = mx - m(x1) + y1
y = mx + c ; where c = y1 - m(x1) --------------------------(2)
Expression (2) is useful for graph plotting and the constant c is the y-intercept. The y-intercept is where the line cuts the y-axis. In another word, (0,c) is always a point on the line y =mx + c.
4. Expression (2) is often being rearranged further into
y - mx -c = 0
Note that if m is a fraction a/b and b is not a zero then the above expression becomes
y - (a/b) x - c = 0 ; multipying the both sides by b will allow us to obtain
by - ax - bc = 0.
The general form is thus,
ax + by + c = 0 ; where a, b, and c are real number constants---------------------(3).
Note that these a, b and c are not the same a, b and c in by - ax - bc = 0.
10. If line L1 and line L2 are parallel to each other then both will have the same gradient.
If L1 is parallel to L2 then m1 = m2 .
11. If line L1 and line L2 are perpendicular to each other then product of their gradients is -1.
If L1 perpendicular to L2 then m1 x m2 = -1 or m1 = -1 / m2.
12. Obtaining linear expressions from various situations.
 Example 1: Two points. A(3,2) and B(6,-4). Find the expression for the line that connects A to B. Solution: We will find the gradient first then use expression (1). m = [-4-2] / [6-3] m = -6 / 3 m = -2 . Pick any point and apply expression (1). Here, we randomly pick point A. y - 2 = (-2)( x - 3 ) y = -2x + 6 + 2 y = -2x + 8. Example 2: Two points. Line L1 passes through the origin and (-2,3). Find the linear expression for L1. Solution: The point origin is simply (0,0). This is thus a problem with two points and we will follow similar method as in previous Example 1. m = [3-0] / [-2-0] m = - 3/2 y - 0 = (-3/2) [ x -0 ] ; the origin (0,0) is an excellent choice because it simplifies the calculation although (-2,3) can also be used. y = - (3/2)x. Example 3: A slope and a point. Line L1 has gradient 2 and passes through (-5,3). Find the linear expression for L1. Solution: We can simply apply expression (2). y - 3 = 2 (x - (-5) ) y = 2x + 10 + 3. y = 2x + 13. Example 4: A rule and a point. Line L1 passes through (4, -2) and is parallel to a straight line that has gradient -3. Find the linear expression for L1. Solution: Since L1 is parallel to a line that has gradient -3 then m1 = -3. We now apply expression (2). y - (-2) = -3 (x - 4) y = -3x + 12 - 2 y = -3x + 10. Example 5: A rule and a point. Line L1 passes through (1,2) and is perpendicular to L2 that has gradient 1/4. Find the linear expression for L1. Solution: Since L1 is perpendicular to L2 then m1.m2 = -1. Thus, m1 = -1 / (1/4) and m1 = -4. y - 2 = -4 ( x - 1) y = -4x + 4 + 2 y = -4x + 6. Example 6: Problem with Sketch Find the linear expression for L1. Solution: Note that L1 passes through the origin (0,0) and L1 is perpendicular to L2. Thus, m1 = -1/m2. We need to find m2 first. The two points on L2 are (0, 5) and (3, 0). Thus m2 = [5-0] / [0-3] m2 = -5/3. So, m1 = -1/ (-5/3) m1 = 3/5. y = 3/5 x
13. Sketching Linear Functions.
1. Given y = 2x + 3. One method simply let x = 0 and solve for y. When x = 0 then y = 3. This is our first point (0,3) and also the y-intercept. When y = 0 then x = -3/2. This is our second point (-3/2,0) and also the x-intercept. Connecting these two points will give us the sketch of y = 2x + 3. This method works for any general form ax + by + c = 0 but I find it easier to imagine the line from the form y = mx + c.
2. Some special cases:
3. Given y + x = 5. Applying method (a) above, we will obtain (0,5) and (5,0). In general a linear form of y + x = a where a is a positive real number then the sketch look like L1 in the diagram at the side. If we are given y + x = -3 then applying method (a) above we will obtain (0,-3) and (-3,0). The general linear form of y + x = - a where a is a positive real number looks like L2 in the diagram at the side.
4. Given a line of the form ax + by = ab where a and b are positive real numbers then applying method (a), we will obtain (0, a) and (b,0). This is L3 in the diagram at the side. Can you spot the special property in the form ax + by =ab ?
5. How would a line of y - x = a , a > 0 look like? [hint: y = mx + c]
6. How would a line of y - x = a , a< 0 look like?

Exercises.