Is there a function for every possible line?
I'm currently in Pre-Calculus (High School), and I have a relatively simple question that crossed my mind earlier today. If I were to take a graph and draw a random line of any finite length, in which no two points along this line had the same $x$ coordinate, would there be some function that could represent this line? If so, is there a way we can prove this?
Solution 1:
As an aside to supplement the answers you have already gotten, I would like to point out that a function doesn't need to have a formula to be considered a function. This is because a function is just a relation between two sets (the domain and range), with the property that you get only a single output for each input (this is the rule that there can only be one $y$ value for each $x$ value).
For instance, I can define a function $f$ from the set $\{0,1,2\}$ to the set $\{5,10,15\}$ by giving the rules
$$f(0)=10 \\f(1)=5 \\f(2)=15$$
It might be difficult or impossible to find a formula for $f$ in which you can plug in $0$, $1$, or $2$ and get the correct answer as a result, yet $f$ is a function since each input gives me a unique result.
By the same token, you can draw a straight line, or a wiggly line, a line with holes in it, or just a bunch of points, etc, and as long as you have ensured that there is no point on the graph where a single $x$ value gives more than one $y$ value you have essentially defined a function. This is true whether you can find a formula for it or not.
Solution 2:
Yes. If the two end points of the line are $(x_1,y_1)$ and $(x_2,y_2)$ then the function is $f:[x_1,x_2]\to \mathbb R$ defined by $f(x)=\frac{y_2-y_1}{x_2-x_1}(x-x_1)+y_1$.