# 3D coordinate system

1. Jul 29, 2012

### Lizwi

Given two points in 3D, is there a way to find the slope of that line.

2. Jul 29, 2012

### chiro

Hey Lizwi.

Your question is incomplete because the slope is usually with respect to some direction.

What you can do is find the direction of the line (take two points on the line with a difference of unit parameter: i.e. take t = 1 and t = 0 and form a vector from those two points), and then project this vector onto some direction vector with length 1.

Alternatively you can simply take your vector calculated with t = 0 and t = 1 and find the length of this vector: this is equivalent to the concept of the total differential that is used in multivariable calculus.

In other geometries, you need to consider the basis, determinant and the stuff in tensor theory but for this example for a normal cartesian geometry, you take the difference of t = 1 and t = 0 and use the fact that the rate of change is constant across the line to give you this 'tangent' vector.

3. Jul 29, 2012

### arildno

A "slope" is always connected to some ANGLE.

And, in order to talk about angles, you need TWO lines.

Thus, you cannot talk about "slope", either, without having some reference line in addition to the line specified by the two points.

Agreed?

4. Jul 29, 2012

### HallsofIvy

Consider a unit vector in the direction of a given line. In two dimensions, it is $<cos(\theta), sin(\theta)>$ where $\theta$ is the angle the line makes with the x-axis. (And the slope is $tan(\theta)$.)

A unit vector in three dimensions is given by $<cos(\alpha), cos(\beta), cos(\gamma)>$ (the "direction cosines" of the direction) where $\alpha$ is the angle the line makes with the x axis, $\beta$ is the angle the line makes with the y axis, and $\gamma$ is the angle the line makes with the z axis. Because this is a unit vector, these must satisfy $cos^2(\alpha)+ cos^2(\beta)+ cos^2(\gamma)= 1$ but this still depends upon two angles so we cannot give a single number, slope or other, that determines the direction of the line.

(Note that in two dimensions we can take $\gamma= 0$ so $cos^2(\alpha)+ cos^2(\beta)= 1$ which means that $cos(\beta)= sin(\alpha)$.)