# Calculate coordinates on a line (or ray)

If I have a ray, that starts at the origin, and has a slope of 0.5, how would I calculate the coordinates of a point at length 3 away from the origin (that's on the ray)?

This isn't homework; I learned this a long time ago, but now it's gone, and I find myself embarrassed at asking something so simple.

-
Solve the system of equations: ${y\over x}={1\over 2}$ and $x^2+y^2=9$. –  David Mitra Jan 11 '12 at 17:32
@DavidMitra - that's perfect - please throw that up as an answer so I can upvote it. –  Adam Rackis Jan 11 '12 at 17:35

You have a right triangle as follows:

$\hskip2in$

The slope of the hypotenuse is $$m=\frac{y-0}{x-0}=\frac{y}{x}.$$

You know that $m$ is equal to $\frac{1}{2}$, so $x=2y$. The Pythagorean theorem says that $$x^2+y^2=3^2=9.$$ Thus $$(2y)^2+y^2=5y^2=9$$ and therefore $$y=\sqrt{\frac{9}{5}}=\frac{3}{\sqrt{5}}\qquad\text{ and }\qquad x=2y=\frac{6}{\sqrt{5}}.$$

-

Let the coordinates of the point in the first quadrant (note there are two points 3 units away, the other in the third quadrant) be $(x,y)$.

Since the slope of the ray is $1\over2$, and since slope is "rise/run": $$\tag{1}{1\over2}={y\over x}.$$ By the Pythagorean Theorem $$\tag{2}x^2+y^2=9.$$

We need to solve the system of equations (1) and (2).

Solving (1) for $y$ gives $$\tag{3}y={x\over 2}.$$ Replacing $y$ in (2) with ${x\over 2}$ gives $$x^2+\bigl({\textstyle{x\over2}}\bigr)^2=9;$$ or $${5x^2\over 4}=9.$$ Solving the above for positive $x$ gives $x^2={9\cdot4 \over 5}$; whence $x=6/\sqrt5$. And then from (3), $y=3/\sqrt5$ (the point in the third quadrant is $x=-6/\sqrt5$, $y=-3/\sqrt5$).

-

Find any non-zero point on the ray. In this case, for example, $(2,1)$ will do. Then the point you are looking for has the shape $\lambda(2,1)=(2\lambda,\lambda)$ where $\lambda$ is positive (because we are dealing with a ray, not a line).

Now use the distance formula (aka the Pythagorean Theorem) to conclude that $4\lambda^2+\lambda^2=9$, so $$\lambda=\frac{3}{\sqrt{5}}.$$

-