Functions - Graphing in the Cartesian Plane First, we need to introduce a few concepts. We have the domain and the range. Thedomain is the set of all possible inputs, X. And the range is the set of all possibleoutputs, Y. When we're going through these examples, they're all going to benumbers. So you can think of them as being like points in a line or points on a grid. Here is a graph of a function. The blue curve is the graph of an equation that wecommonly call f(x). On the other hand, you probably also have in mind anotherpicture of a function, which looks like what is on the big screen over here. Namely,this line here with this blue curve here. What those actually are are graphs offunctions—graphs of functions that happen to be from the set of real numbers to theset of real numbers. Today's lecture is about convincing you of this and talking to youabout how these graphs are different from functions themselves and building someimportant vocabulary for later. Suppose we have a function F from the real line to the real line. So here is a copy ofthe real line. Here is a copy of the set of real numbers thought of as sets. Here's ourlittle conveyor belt. Here's the machine that is the function, who knows what's goingon in there? And here is the conveyor belt coming out. And in some sense, everysingle real number X, comes into the machine, moves in, some stuff happens to it,
and it comes out as F(X), which lands over here. That's still the same picture. It's stillvalid. The problem is that there are infinitely many infinite sets. Unlike a function on afinite set, which can be specified using a formula, a function on the real line cannot.So we usually have to give you a formula when we define a function for the real line.For example, we might see a formula like F of X equals 2X minus one. And thiswould be the formula that defines this function. This is a rule that tells you how tooperate the machine. Any input you give the machine, it tells you how to make theoutput. So for example if one comes in, we know that F of one, follow the rule andplug in 1 for x, 2 times one minus one that turns out to be equal to: 2(1) - 1 = 1. If weplug it in zero. F of zero equals two times zero, minus one is minus 1.If we substitute a real number that is not an integer, like 5.1, we get 2(5.1) - 1 or 10.2- 1. That's the idea of the function. And you can have more complicated formulas.For example, could we write that the G of X equals the absolute value of x, which wesaw before? That's a formula that was often given by cases. This is equal x if x isgreater than or equal to zero; minus X if x is less than zero. In both cases, both Fand G here are functions because they take input values—X—and spit out F of x orG of x. In this case you just have a formula for how to do it. What's the point of a graph? Well what's the correspondence when we graph whatwe saw? So let's draw what you all know is the graph of the expression Y equals 2 xminus one. You saw before how to plot the equation in a line. So there's a Yintercept, minus one. Always good to review. Slope is 2, so it goes about like that.So, this symbol here, this is actually not the function, this is the graph of the function.This is the graph of the function F from R to R whose formula is F of x equals 2 Xminus one. Now what's the point about that distinction? But, this is a nice visualpicture. This allows you to depict all input and output pairs at once.For example, if x = 0, we look at zero, then think of where it goes until we meet thegraph, and that point there is (0, f(0)), which we know equals (−1). If we say take the
point 5.1 to about there and look till it meets the graph, there it is: (5.1, f(5.1)). Ingeneral if G is a function from R to R, then the graph of G is a set of points in theplane; call it the graph of G. This equals the set of all points x comma y such that y =G(x). And that's a very important distinction: visual way of drawing the graph. Let's see some examples. For example, suppose we have the equation G of x = x ifx is greater than or equal to zero and -x if x is less than zero. We already know thatthe graph of this equation looks like this. Well, this is a familiar shape; many studentshave seen it before. What we see here is that every single point on this graph has itsy coordinate equal to the absolute value of its x coordinate. So in other words, if welook at the point (2, 2) for example, we see that 2 is the absolute value of 2. Similarly,if we look at (-2) and its corresponding y coordinate, which is also 2.
Suppose H of x is equal to x squared. That's one of the things that we saw at thebeginning. So let's draw our axes. One thing we're going to learn here is how tograph a function if you don't know what it looks like. The other two are sort ofcheating. There's no magic bullet here, there's no tried and true answer. Really, oftenwhat you do is test out a bunch of input-output pairs, see a pattern, and try to draw acurve through it. The astute listeners among you will realize that's exactly what youdo in supervised learning—you try to figure out what the function is going to look likeby querying some inputs with the network and seeing what outputs it gives you. Solet's make, for example, a table. Here is H of x and let's figure out a table. So if xequals zero and H of x would be zero squared equals zero. So let's plot the point,(zero, zero) on the graph. If x equals one then H of x is one squared equals one.Let's plot the point (1,1) on the graph. If x equals two, then two squared equals four.Lets plot the point (2, 4).Three squared equals nine. We're going way up there. So it looks like a curve goingup like that. Let's try some negative numbers. Negative one, we know that negativeone squared equals one. Pretty soon we'll see a pattern of symmetry like that. Andthat's about what the graph of y equals x squared looks like. In a later video, you'lllearn a bunch of patterns and what later functions look like, quadratic functions likethis one look like, cubic functions look like, exponential functions look like and thingslike that.
Here's an important fact to remember, the vertical line test. To illustrate the effect ofthis test, we're going to draw some graphs on the plane. Only one of them is actuallythe graph of a function. There is one guy. There's another one, and choose anothercolor, let's try yellow, say take a third graph like this. Okay so those are threepurported graphs. Here's an interesting fact: red could be the graph of say y equals xminus one. Blue could be a graph of a function even if we can't think of a formulathat also could be a graph. Here is the wonderful fact: yellow cannot be a graph ofany function. There is no function whose graph is yellow.The graph fails the vertical line test. Namely, a vertical line drawn through the graphintersects the curve at two points. This is a problem because it suggests that onecould assign two different values to the y-coordinate of x, which is illegal because afunction takes one thing from set A and assigns it to another thing in set B.The vertical line test is a simple way to determine whether or not two graphs areequal. If a vertical line intersects a graph once, it must intersect the same graph atthat same point no matter where on the line you draw it. This can only happen if thegraphs are identical. However, if a vertical line intersects a graph more than once,then those two graphs cannot be equal.