<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Lesson 3
This lesson will review linear equations, briefly discuss kinematics and see how we can write functions in python to reuse code.
Linear Equations
Recall the definition of a line is $y(x) = mx + c$. Where $m$ is the slope of the line and $c$ is the y-intercept. See if you can find the equation of the line below.
<img src="ygraph.png" alt="Drawing" style="width
Step1:  Look at some sample outputs below
Step2:  We can define a function in python by the def keyword, followed by the name of the function, a set of parenthesis with its inputs or paramaters and a 
Step3:  Whenever we call print_double, we ask the function to print $2x$ so we don't have to.
Step4:  A function can also have multiple parameters, or no parameters at all. Remember, the parameters are the things that go in between the paranthesis. Suppose that we want a function that takes in zero parameters and always returns $1337$, we just leave the parameter section blank.
Step5:  What do you think will happen if we run 
python
print leet();
Try it below!
Step6:  Recall that the slope of a line that goes through $(x_1, y_1)$ and $(x_2, y_2)$ is $\frac{y_2-y_1}{x_2-x_1}$. Write a function that takes in four parameters x1,y1,x2,y2 and finds the slope of the line that goes through the two points. Call it find_Slope.
Step7:  Recall the example of you and your friend walking home from school. Now we will write a function that will calculate the time difference of arrival for an abstract sense. If your friend lives a distance $a$ miles away from you and you both decide to hang out at a location $x$ during the weekend, what will be the time difference of arrival of you and your friend getting home? Both of you walk with the same speed $s$. Answer the questions below to help find the TDOA.
How far do you have to walk home?
How long does it take for you to walk home?
How far does your friend have to walk home?
How long will it take him to walk home?
What is the difference in these two times?
Write a python function below that takes in $a$ (friends house), $x$ (hangout location) and $s$ (the speed you two walk) and returns the TDOA. The function declaration should be 
python
def TDOA(a, x, s)
Step8:  Now we have a function that given a position finds the time difference of arrival. What if we want to find the position of your hangout spot given the TDOA? Write a function called find_position that takes in the position of your friend's house $a$, a time difference of arrival ($t$), and speed ($s$) and returns the position of your hangout location.
<ASSISTANT_TASK:>
Python Code:
def double(x):
    return(2*x);
Explanation: Lesson 3
This lesson will review linear equations, briefly discuss kinematics and see how we can write functions in python to reuse code.
Linear Equations
Recall the definition of a line is $y(x) = mx + c$. Where $m$ is the slope of the line and $c$ is the y-intercept. See if you can find the equation of the line below.
<img src="ygraph.png" alt="Drawing" style="width: 300px;"/>
The slope of the line is $2$ and the y-intercept is $4$, so the equation is $y(x) = 2x+4$. If we are told that a line goes through two points $(x_1, y_1)$ and $(x_2,y_2)$, we can also find the equation of the line. We know that since the slope is defined as rise over run: $m = \frac{y_2-y_1}{x_2-x_1}$. Now that we have found the slope of the line, how can we find the y-interccept? The line goes through $(x_1, y_1)$ so $y_1 = mx_1 + c$ and hence $c = y_1-mx_1$. Alternatively, we also know that the line goes through $(x_2, y_2)$ so $y_2 = mx_2 + c$ and $c = y_2 - mx_2$. Now we have found both $m$ and $c$ so we know the equation of the line!
Example Problems
1. What is the slope of the line that goes through the points $(1,2)$ and $(3,4)$?
2. What is the y-intercept of the line that goes through $(1,2)$ and $(3,4)$?
3. What is the equation of the line that goes through the points $(1,2)$ and $(3,4)$?
Basic Kinematics
Kinematics is defined as the study of motion and one branch of it looks at the relationships between position, speed, and time. 
The position of an object is where it is relative to an origin at a specific moment in time. If your school is two miles away from home, then at this moment your position, relative to your home, is two miles. When you leave school and decide to go home, your position will slowly decrease as you walk home until it reaches zero miles. 
The speed of an object is how fast it is moving at a specific moment in time. If you walk from your house to school in one hour, then your speed would have been two miles per hour. If, instead, you decided to bike from home to school and it only took you half an hour, your speed would have been four miles per hour. 
If you decide to skip school (please don't) to go the new arcade four miles away from your house, it will take you twice as long because you have to travel twice the distance. If you decide to walk there, it will take you two hours and if you bike there, it will take you one hour.
In general we have the following relationship $position = speed \times time$ or $p(t) = st$. But wait, doesn't this look really similar to our linear equation above? $p(t) = st + 0$ and $y(x) = mx + c$. Its just a linear line with a y-intercept of zero! The same properties hold as well. Since $s$ is the "slope" of this graph, we can calculate $s$ by taking the rise over run of the graph or the change in position divided by the change in time. The time it takes to travel from one one position to  another is the change in position divided by the speed. 
The equations are summarized below. $\Delta$ is the shorthand notation for "change in".
1. $p(t) = st$
2. $s = \frac{\Delta p}{\Delta t}$
3. $t = \frac{\Delta p}{\Delta s}$
Suppose your friend lives four miles away from school, but in the opposite direction. If he walks just as quickly as you, how long will it take him to get home? 
<img src="school.png" alt="Drawing" style="width: 750px;"/>
Because he lives four miles away and walks at two miles per hour, it will take him $\frac{4}{2} = 2$ hours. This is one hour after you arrive at your home (it takes you one hour to get home by foot). We define this as the time difference of arrival. However, if you lived four miles away and your friend lived two miles away, he would have gotten home one hour before you have, and the time difference of arrival would be negative (-1 hours). Notice that the time difference of arrival is also how much more distance your friend has to travel over his speed.
Problem
What would be the time difference of arrival if you lived 3 miles away from school and your friend also lived 3 miles away from school?
Functions in Python
In programming, a function refers to a procedure that does something for you! Much like how in mathematics a function takes in an "input" and returns an "output" after performing some operations on the inputs.
Below is a function that returns the double of an input;
End of explanation
print double(1);
print double(2);
print double(3);
Explanation: Look at some sample outputs below
End of explanation
def print_double(x):
    print(2*x);
Explanation: We can define a function in python by the def keyword, followed by the name of the function, a set of parenthesis with its inputs or paramaters and a :. The code that modifies our inputs is in the lines that follow. It has the general format of
python
def name(parameters):
    code;
Look at our definition of double again and notice that we return the value $2x$. We then print out double(1) which prints out the return value $2 \times 1$. However, it is not required for a function to return anything! A function is still valid even it doesn't explicitly return anything. An example is shown below.
End of explanation
print_double(1);
print_double(2);
print_double(3);
Explanation: Whenever we call print_double, we ask the function to print $2x$ so we don't have to.
End of explanation
def leet():
    return 1337;
Explanation: A function can also have multiple parameters, or no parameters at all. Remember, the parameters are the things that go in between the paranthesis. Suppose that we want a function that takes in zero parameters and always returns $1337$, we just leave the parameter section blank.
End of explanation
#Try what "print leet()" does.
#Enter your code here:
Explanation: What do you think will happen if we run 
python
print leet();
Try it below!
End of explanation
#Write your function here
#Solution
def find_Slope(x1,y1,x2,y2):
    return (y2-y1)/(x2-x1);
Explanation: Recall that the slope of a line that goes through $(x_1, y_1)$ and $(x_2, y_2)$ is $\frac{y_2-y_1}{x_2-x_1}$. Write a function that takes in four parameters x1,y1,x2,y2 and finds the slope of the line that goes through the two points. Call it find_Slope.
End of explanation
#Write your function here
#Solution
def TDOA(a, x, s): 
    return (a-2.0*x)/s;
Explanation: Recall the example of you and your friend walking home from school. Now we will write a function that will calculate the time difference of arrival for an abstract sense. If your friend lives a distance $a$ miles away from you and you both decide to hang out at a location $x$ during the weekend, what will be the time difference of arrival of you and your friend getting home? Both of you walk with the same speed $s$. Answer the questions below to help find the TDOA.
How far do you have to walk home?
How long does it take for you to walk home?
How far does your friend have to walk home?
How long will it take him to walk home?
What is the difference in these two times?
Write a python function below that takes in $a$ (friends house), $x$ (hangout location) and $s$ (the speed you two walk) and returns the TDOA. The function declaration should be 
python
def TDOA(a, x, s):
End of explanation
#Write your function here
#Solution
def find_position(a, t, s):
    return (a-s*t)/2.0;
Explanation: Now we have a function that given a position finds the time difference of arrival. What if we want to find the position of your hangout spot given the TDOA? Write a function called find_position that takes in the position of your friend's house $a$, a time difference of arrival ($t$), and speed ($s$) and returns the position of your hangout location.
End of explanation
<END_TASK>