# Formula for cylinder

In an exercise I was asked to find a formula of the form $F(x,y,z)=C$ for a cylinder though the axis $(t,t,t)$ and radius $R$. The formula I got seemed a bit suspicious so I wanted to ask if I have it right.

Basically I used the vector formula for the distance between a line and a point found here: http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html. I chose $x_1=(0,0,0), x_2=(1,1,1)$ to determine the line. Marking $r=(x,y,z)$ for a point on the cylinder, after some simplification and moving things around in the equation, I got that each point on the cylinder needs to fulfill the formula:

$$(y-z)^2+(z-x)^2+(x-y)^2=3R^2$$

Have I correctly derived the formula?

Thanks a bunch!

-
An alternative thing to do is to do a simpler cylinder, e.g. the one around the $z$-axis, which has equation $x^2+y^2=R^2$, and then perform a rotation of the plane that moves the $z$-axis to the line $x=y=z$ and see what this rotation does to the equation. – Arturo Magidin May 6 '12 at 3:33
@ArturoMagidin: Can you explain this method in more detail? Thank you. – ro44 May 6 '12 at 3:39
I was about to suggest the same thing as Arturo. You can use the Rodrigues rotation formula with the angle $\arccos\frac1{\sqrt 3}$ and axis $\langle 1,-1,0\rangle$ to yield the rotation matrix $$\begin{pmatrix}\frac{3+\sqrt 3}{6}&\frac{\sqrt 3-3}{6}&-\frac1{\sqrt 3}\\\frac{\sqrt 3-3}{6}&\frac{3+\sqrt 3}{6}&-\frac1{\sqrt 3}\\\frac1{\sqrt 3}&\frac1{\sqrt 3}&\frac1{\sqrt 3}\end{pmatrix}$$ and use that to rotate your cylinder. (Alternatively, you can compose two simpler rotations: a rotation by $\frac{\pi}{4}$ and a rotation by $\arccos\frac1{\sqrt 3}$ along appropriate axes.) – J. M. May 6 '12 at 3:44

$$r^2=\frac{\|\langle x,y,z\rangle\times(\langle x,y,z\rangle-\langle 1,1,1\rangle)\|^2}{1^2+1^2+1^2}=\frac{(z-y)^2+(x-z)^2+(y-x)^2}{1^2+1^2+1^2}$$