# From Graphs to Function Machines and Back

Shodor > Interactivate > Discussions > From Graphs to Function Machines and Back

Mentor: Function machines involve an input value and an output value. I have a function machine without a formula or a description. There is something else here that is supposed to tell me how the machine works. It looks like a line on a grid. If you give me a number to put into the machine, I will use this line as my function machine to find out what number comes out. Student: Use 3 as input.

Mentor: My pleasure. I just count 3 steps to the right from zero. Then I go vertically (straight up or down) up to the line, counting steps. Here, I go up: One, two, three, four steps. 4 is the number that this function produces out of 3! Student 1: Can I try it? I want to put 1 into the function machine. I start from zero, make one step to the right, then go straight up counting the steps: One, two. So the function produces 2 when you put 1 into it!

Student 2: Do you ever go to the left of zero?

Mentor: Sure. The numbers for steps to the left of zero are called negative numbers. We put a small minus sign in front of a number to show that it is to the left of zero, or negative. Likewise, we use a minus sign to mean "down." Who wants to try the machine on negative numbers?

Student: I want to put -5 into the machine. I go five steps to the left from zero, then up... no wait, down to the line: One, two, three, four steps down.

Mentor: So the function produces -4 when the input is -5. Student: I know exactly what the machine does! It adds 1 to the input numbers.

Mentor: The line told you that! This line, called a graph, is just another way of explaining what the function does. Would you like to try another "line-as-machine-instruction"?

Student: Of course!

Mentor: Let us now start from formulas, and build graphs from them. For simpler formulas, computers can draw graphs very well, but you may want to know how to draw one yourself. You do not have to learn to do it as quickly as a computer can, but the general idea will help you understand other concepts, such as topics from statistics or calculus.

I would like to have a function that tells us the area of the square, Y, when we know the length of its side, X. How are X and Y connected?

Student 1: The area is the length of the side squared.

Student 2: Yes, Y is X times itself.

Mentor: And who wants to tell me how it will look when written as a formula?

Student: "Y is X squared" translates into:

Y=X 2

Mentor: Now we can transform the formula into the graph. We will use negative numbers too. Of course, a square with sides of negative length do not exist. But if we just consider the formula, we can use all real numbers. We can start by drawing just a few points, and see if there is a pattern on the plane. We pick any numbers we want for X, find the appropriate Y, and then go from 0, "walking" X units left or right, and then Y units up or down. So, let's look at some numbers!

Student 1: We can write the X's we select, and Y's we get from the formula, right next to each other:

 X Y 2 4 -1 1 3 9 ... ...

Student 2: I will draw the pairs on the coordinate plane. The first one is 2 and 4. We start from 0 and go 2 steps to the right, 4 up, and here we have the point. And so on with more points.

Mentor: We need to put enough points on the plane to see a pattern and guess what happens in-between the points we have.

Student: It takes a long time! Here are some points: Mentor: Now if we draw a graph dot by dot, we can use it to predict the values of Y by the values of X. It should work just as well as the formula.

Student: Let's see. Suppose I want to find Y for X=2.5. I go 2.5 units to the right, and then up to the graph... It is a little more than 6.

Mentor: What value does the formula give you for Y?

Student: 2.5 2 = 6.25 That is what the graph shows.

Mentor: There are two ways of doing it faster. One way is to learn general laws that will help you draw functions using just a few critical points and by learning a little about how functions behave. Advanced algebra and calculus study these methods. Another way is to use a computer or a calculator to do the tedious job of finding coordinates, drawing points, and then connecting them. Let us make several more graphs of functions.
{"ft_lang_label":"__label__en","ft_lang_prob":0.928863,"math_prob":0.9439939,"size":4174,"snap":"2021-43-2021-49","text_gpt3_token_len":1093,"char_repetition_ratio":0.13093525,"word_repetition_ratio":0.0,"special_character_ratio":0.25083852,"punctuation_ratio":0.15555556,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9952671,"pos_list":[0,1,2,3,4,5,6,7,8,9,10],"im_url_duplicate_count":[null,5,null,5,null,5,null,5,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-10-18T08:23:22Z\",\"WARC-Record-ID\":\"<urn:uuid:357cd8e2-f1fb-4b43-87bb-f4d106eb85ca>\",\"Content-Length\":\"19018\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:020e8bfb-5b42-4943-b830-d337a0f35491>\",\"WARC-Concurrent-To\":\"<urn:uuid:7314174a-740b-418c-98d4-0b6bc6525d81>\",\"WARC-IP-Address\":\"204.85.28.50\",\"WARC-Target-URI\":\"http://www.shodor.org/interactivate/discussions/FromGraphsToFunction/\",\"WARC-Payload-Digest\":\"sha1:IHQR57KWMULETKYNCF6EG6IY7M3D5SMW\",\"WARC-Block-Digest\":\"sha1:2VZUASRZROAK6O73GM7FQQYX2DBLPVBN\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-43/CC-MAIN-2021-43_segments_1634323585199.76_warc_CC-MAIN-20211018062819-20211018092819-00373.warc.gz\"}"}