class: center, middle, inverse, title-slide .title[ # Lesson 17: Linear Modeling ] .author[ ### Fei Ye ] .date[ ### May, 2024 ] --- class: center middle
## Unit 9B: Linear Modeling *Primary Source:* PPT for the book "Using & Understanding Mathematics". --- ## Linear Functions - A **linear function** has a constant rate of change and a straight-line graph. - The **rate of change** is equal to the **slope** of the graph. - The greater the rate of change, the steeper the slope. - Calculate the rate of change by finding the slope between any two points on the graph. $$ \text{rate of change}=\text{slope}=\dfrac{\text{change in dependent variable}}{\text{change in independent variable}} $$ --- ## Finding the Slope of a Line To find the slope of a straight line, look at any two points and divide the change in the dependent variable by the change in the independent variable. .center[ ![](data:image/png;base64,#img/SlopeOfaLine.png) ] --- ## Example: A Price-Demand Function (1/2) A small store sells fresh pineapples. Based on data for pineapple prices between $2 and $5, the store owners created a model in which a linear function is used to describe how the demand (number of pineapples sold per day) varies with the price. For example, the point ($2, 80 pineapples) means that, at a price of $2 per pineapple, 80 pineapples can be sold on an average day. What is the rate of change for this function? Discuss the validity of this model. **Solution:** Point 1 ($2, 80) and Point 2 ($5, 50). Change in demand is `\(50 - 80 = -30.\)` The change in demand is negative because demand decreases from Point 1 to Point 2. --- ## Example: A Price-Demand Function (2/2) .center[ ![](data:image/png;base64,#img/PriceDemandFunction.png) ] $$\text{rate of change}=\dfrac{\text{change in demand}}{\text{change in price}}=\dfrac{-30}{\$3}=\dfrac{-10}{\$1}.$$ For every dollar that the price *increases*, the number of pineapples sold *decreases* by 10. --- ## The Rate of Change Rule The rate of change rule allows us to calculate the change in the dependent variable from the change in the independent variable. `$$\begin{pmatrix}\text{change in the}\\\text{dependent}\\\text{variable}\end{pmatrix} =\begin{pmatrix}\text{rate of}\\\text{change}\end{pmatrix} \times \begin{pmatrix}\text{change in the}\\\text{independent}\\\text{variable}\end{pmatrix}$$` --- ## Example: Change in Demand .pull-left[ Using the linear demand function in the figure, predict the change in demand for pineapples if the price increases by $3. **Solution:** ] .pull-right[ ![:resize , 80%](data:image/png;base64,#img/LinearDemandFigure.jpg) ] `$$\text{Independent variable} = \text{price of the pineapples}$$` `$$\text{Dependent variable} = \text{demand for pineapples}$$` `$$\text{Rate of change of demand} = -10 \text{pineapples per dollar}$$` `$$\begin{aligned}(\text{change in demand}) =& (\text{rate of change}) \times (\text{change in price})\\ = & -10\times 3 = -30\, \text{pineapples}.\end{aligned}$$` --- ## Equations of Lines ### General Equation for a Linear Function `$$\begin{pmatrix}\text{dependent}\\\text{variable}\end{pmatrix} = \begin{pmatrix}\text{rate of}\\\text{change}\end{pmatrix}\times\begin{pmatrix}\text{independent}\\\text{variable}\end{pmatrix}+\begin{pmatrix}\text{initial}\\\text{value}\end{pmatrix}$$` ### Algebraic Equation of a Line In algebra, `\(x\)` is commonly used for the independent variable and `\(y\)` for the dependent variable. For a straight line, the slope is usually denoted by `\(m\)` and the initial value, or `\(y\)`-intercept, is denoted by `\(b\)`. With these symbols, the equation for a linear function becomes `\(y = mx + b.\)` --- ## Slope and Intercept .pull-left[ For example, the equation `\(y = 4 x - 4\)` represents a straight line with a slope of `\(4\)` and a `\(y\)`-intercept of `\(-4\)`. As shown to the right, the `\(y\)`-intercept is where the line crosses the `\(y\)`-axis. ] .pull-right[ ![](data:image/png;base64,#img/SlopeIntercept.png) ] --- ## Varying the Slope .pull-left[ The figure to the right shows the effects of keeping the same `\(y\)`-intercept but changing the slope. A positive slope ( `\(m > 0\)`) means the line rises to the right. A negative slope ( `\(m < 0\)`) means the line falls to the right. A zero slope ( `\(m = 0\)`) means a horizontal line. ] .pull-right[ ![](data:image/png;base64,#img/VaringTheSlope.png) ] --- ## Varying the Intercept .pull-left[ The figure to the right shows the effects of changing the `\(y\)`-intercept for a set of lines that have the same slope. All the lines rise at the same rate, but cross the `\(y\)`-axis at different points. ] .pull-right[ ![](data:image/png;base64,#img/VaryingTheIntercept.png) ] --- ## Example: Rain Depth Equation .pull-left[ Use the function shown to the right to write an equation that describes the rain depth at any time after the storm began. Use the equation to find the rain depth 4 hours after the storm began. ] .pull-right[ ![:resize , 50%](data:image/png;base64,#img/RainDepth.png) ] **Solution:** Since `\(m = 0.5\)` and `\(b = 0\)`, the function is `\(r = 0.5 t\)`. After `\(4\)` hours, the rain depth is `\(r = (0.5)(4) = 2\text{ inches}.\)` --- ## Creating a Linear Function from Two Data Points - **Step 1:** Let `\(x\)` be the independent variable and `\(y\)` be the dependent variable. Find the change in each variable between the two given points, and use these changes to calculate the slope, or rate of change. `$$\text{slope}=\dfrac{\text{change in }y}{\text{change in }x}$$` - **Step 2:** Substitute the slope, `\(m\)`, and the numerical values of `\(x\)` and `\(y\)` from either point into the equation `\(y = mx + b\)` and solve for the `\(y\)`-intercept, `\(b\)`. - **Step 3:** Use the slope and the `\(y\)`-intercept to write the equation in the form `\(y = mx + b\)`. --- ## Example: Oil Use (1 of 4) Until about 1850, humans used so little crude oil that we can call the amount zero--at least in comparison to the amount used since that time. By 1960, humans had used a total (cumulative) of 600 billion cubic meters of oil. 1. Create a linear model that describes world oil use since 1850. 2. Discuss the validity of the model. **Solution:** Data points: (1850, 0), (1960, 600) Find the slope: `$$m=\frac{600-0}{1960-1850}=\frac{600}{110}=5.45 \text{ billion } \mathrm{m}^{3} \text{ per year}$$` --- ## Example: Oil Use (2 of 4) Looking for an equation of the form `\(y=m t+b\)`. Since `\(m=5.45\)`, the equation should be in the form `\(y=5.45t+b\)`. Find `\(b\)` using a data point, say `\((1850, 0)\)`. Plug it in `\(y=5.45t+b\)` and solve for `\(b\)`. $$ `\begin{aligned} 0=&5.45(1850)+b\\ b=&-10,083 \text{ billion } \mathrm{m}^{3} \text{ per year} \end{aligned}` $$ Equation: `\(y=5.45 t-10,083\)`. --- ## Example: Oil Use (3 of 4) Validity as a model for oil consumption. Draw the graph only for years after 1850. Years prior to 1850, in which we assumed oil consumption to be zero, are not in the domain of the function. The more significant issue is whether the rise in oil consumption has been linear. The rate of oil consumption tends to increase with population. In fact, it has increased more rapidly than population because the average person uses more oil now than in the past. --- ## Example: Oil Use (4 of 4) We know that population has risen exponentially since the mid-19th century, so a better model for oil consumption would be exponential instead of linear. The blue curve in the figure shows an exponential fit to the two data points. .center[ ![](data:image/png;base64,#img/OilUseModel.png) ] --- ## Practice: Sign of the Slope .iframecontainer[ <iframe src="https://www.myopenmath.com/embedq2.php?id=271490&seed=2021&showansafter" width="100%" height="400px" data-external="1"></iframe> ] .footmark[ <a href="https://www.myopenmath.com/embedq2.php?id=271490&seed=2021&showansafter" target="_blank">Click here to open the practice in a new window</a> ] --- ## Practice: Car Rental The cost of renting a car is $20 plus 50 cents per mile. 1. Create a function to model the cost. 2. How much does it cost to drive for 100 miles. --- ## Practice: Balance of a Savings Account with Monthly Deposit .iframecontainer[ <iframe src="https://www.myopenmath.com/embedq2.php?id=511055&seed=2021&showansafter" width="100%" height="400px" data-external="1"></iframe> ] .footmark[ <a href="https://www.myopenmath.com/embedq2.php?id=511055&seed=2021&showansafter" target="_blank">Click here to open the practice in a new window</a> ] --- ## Practice: Linear Demand Function .iframecontainer[ <iframe src="https://www.myopenmath.com/embedq2.php?id=107914&seed=2021&showansafter" width="100%" height="400px" data-external="1"></iframe> ] .footmark[ <a href="https://www.myopenmath.com/embedq2.php?id=107914&seed=2021&showansafter" target="_blank">Click here to open the practice in a new window</a> ] --- ## Practice: Linear Function from Graph .iframecontainer[ <iframe src="https://www.myopenmath.com/embedq2.php?id=78880&seed=2021&showansafter" width="100%" height="400px" data-external="1"></iframe> ] .footmark[ <a href="https://www.myopenmath.com/embedq2.php?id=78880&seed=2021&showansafter" target="_blank">Click here to open the practice in a new window</a> ]