Hello, nathan02079!
In your "distance formula", you're squarerooting when you should square.
2. From a lighthouse, the range of visibility on a clear day is 40 km.
On a coordinate system, where O(0,0) represents the lighthouse,
a ship is travelling on a course represented by: $\displaystyle y\:=\:2x+80$.
Between which two points on the course can the ship be seen from the lighthouse? Code:

 *
 *
Q * 
o 
* * 
P * * 
o * 
* * * 
* *
           *    
O
$\displaystyle P$ and $\displaystyle Q$ have coordinates $\displaystyle (x,y)$ such that: .$\displaystyle OP = OQ = 10.$
We want: .$\displaystyle x^2 + y^2 \:=\:10^2$
So we have: .$\displaystyle x^2 + (2x+80)^2 \:=\:10^2 \quad\Rightarrow\quad 5x^2 + 320x + 4800 \:=\:0$
Factor: .$\displaystyle 5(x+40)(x+24) \:=\:0$
Then: . $\displaystyle x \:=\:\text{}40,\:\text{}24 \quad\Rightarrow\quad y \:=\:0,\:32$
The ship can be seen from $\displaystyle (\text{}40,\:0)$ to $\displaystyle (\text{}24,\:32)$