-
Notifications
You must be signed in to change notification settings - Fork 0
/
06-straight_line_graphs.qmd
129 lines (93 loc) · 5.21 KB
/
06-straight_line_graphs.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Straight line graphs
```{r, include=FALSE}
knitr::opts_chunk$set(
dev = 'png', screenshot.opts = list(cliprect = 'viewport', delay = 2)
)
warning = ""
```
```{r, echo=FALSE, eval=(knitr::pandoc_to("html"))}
warning = '<img src="img/desmos.gif" style="float: left;" height="75px"><p>The graphs and diagrams created in <a href="https://www.desmos.com/calculator">desmos</a> are interactive just click on the <em>edit in desmos button</em> to open the desmos graph in a new tab.</p>'
```
It is often useful to plot graphs of functions to gain an understanding of what they mean. Straight line graphs are produced by linear equations. Linear equations like $y=2x+4$ only have $x$ to the power of one only. Note: this doesn't just apply to $x$, it could be whatever variable you are using.
## Coordinates
To build a picture of a function we work out pairs of values that satisfy the function. Take for example $y=\frac{1}{2}x+1$. If we choose values of $x$ we can work out the corresponding $y$ values.
| $x$ | $y$ |
|:---:|:---:|
| $0$ | $\frac{1}{2}(0)+1=1$ |
| $1$ | $\frac{1}{2}(1)+1=1.5$ |
| $2$ | $\frac{1}{2}(2)+1=2$ |
Once we have these values they can be plotted on graph.
```{r, echo=FALSE}
knitr::include_url("https://www.desmos.com/calculator/jzyasdusre?embed")
```
The red dots show the points and the blue line shows the equation.
By working out some co-ordinates in the following question try to generate the correct line.
```{r, echo=FALSE}
knitr::include_url("https://numbas.mathcentre.ac.uk/question/68532/linear-graphs-plotting-1-integer-values/embed/?token=c4963f30-f814-4d6f-91bc-b631f0ed1ec3", height="800px")
```
## The formula for a straight line graph: $y=mx+c$
Straight line graphs can be defined by two quantities. The gradient, $m$, a measure of how steep the line is, and the $y$ intercept, $c$, where the line crosses the $y$ axis.
### The y intercept: $c$
The $y$ intercept is where line crosses the $y$ axis. We can quickly work out the co-ordinate by substituting $x=0$ into the equation of a line, or, by noticing the constant term in equation where $y=mx+c$. Here are two examples:
For the line $y = 3x +4$, the $y$ intercept is at $(0,4)$ i.e. it crosses the $y$ axis at $4$. We can check this by substituting $x=0$ into the equation.
$$
\begin{aligned}
y &= 3x +4 \\
&= 3(0) +4 \\
&= 3\times0 +4 \\
y &= 4
\end{aligned}
$$
We need to be careful with the next example: $y + 2 = 5x$. It's tempting to say that the $y$ intercept is $2$ but it's not. First we must re-arrange the equation into the form of $y=mx+c$. We'll use the idea of doing the same thing to both sides again.
$$
\begin{aligned}
y +2 &= 5x \\
y+2-2 &= 5x-2 \\
y &= 5x-2
\end{aligned}
$$
Once we've done this we can see that the intercept is when $y=-2$. Notice if we substituted $x=0$ in the original equaiton we would get this answer too.
$$
\begin{aligned}
y +2 &= 5x \\
y+2 &= 5(0) \\
y +2 &= 0 \\
y &= -2
\end{aligned}
$$
Click on the graph below and play with the slider for $c$. Notice how the graph moves up and down.
```{r, echo=FALSE}
knitr::include_url("https://www.desmos.com/calculator/llcrsdgmvo?embed", height="500px")
```
`r warning`
### The gradient: $m$
The gradient of a graph is a measure of how much steep the line is. The value of $m$ is the change in the $y$ axis for each increase of $1$ in the $x$ axis. So a gradient of $m=2$ would mean the $y$ values increase by $2$ for each increase of $1$ in the $x$ direction. This is a positive gradient. Contrast this to a value of $m$ such as $-0.5$. This means for each increase of $1$ in the $x$ direction, the corresponding $y$ value decreases by $0.5$ or a half. This is a negative gradient.
The gradient can also be found by calculating the change in the $y$ direction divided by the change in the $x$ direction. The graph below shows how you could calculate the gradient of the line. The line shown has a gradient of $\frac{2}{3}$.
:::{.callout-tip}
## Pro tip
A change in a quantity is often represented by the Greek letter delta, $\Delta$, so we can rewrite $m$ as: $m = \frac{\Delta y}{\Delta x}$
:::
```{r, echo=FALSE}
knitr::include_url("https://www.desmos.com/calculator/a3c9vcaede?embed", height="500px")
```
Click on the graph below and then change the value of $m$ with the slider. Notice how the gradient changes but the $y$ intercept stays the same.
```{r, echo=FALSE}
knitr::include_url("https://www.desmos.com/calculator/z9r3fkyrcf?embed", height="500px")
```
`r warning`
:::{.callout-note}
* $m$ is the gradient - the amount $y$ changes for an incease in $1$ in the $x$ direction
* $c$ where the line crosses the $y$ axis
* $m$ and $c$ only make sense when the line is in the form $y=mx+c$
:::
:::{.callout-warning}
## Different notation - same thing
The equation of a straight line can be written using different letters. They all mean the same thing. You may see:
* $y = mx + b$
* $y = mx + y_0$
* $y = ax + b$
:::
Using your knowledge of $y=mx+c$ try the following questions. Don't be afraid to look at the answers and then try a fresh set of questions if it seems tricky at first.
```{r, echo=FALSE}
knitr::include_url("https://numbas.mathcentre.ac.uk/question/104226/linear-graphs-reading-gradient-and-intercept-from-an-equation/embed/?token=2d71329a-7508-4dfa-9115-96abe822746a", height="800px")
```