equation of tangent plane to sphere, given 2 points lying on plane? i have sphere $x^2+y^2+z^2=r^2$ and a vector with points $P=(x_1,y_1,z_1)$ and $Q=(x_2,y_2,z_2)$, i need equation of tangent plane where above two points lyes and touches the sphere in one point only?
 A: So we want the plane that passes both $P$ and $Q$ and touches the sphere. Let that point, where the sphere and the plane meet be $X(\alpha, \beta, \gamma)$.
Since $X$ is on the sphere, it satisfies $\alpha^2+\beta^2+\gamma^2=r^2$.
Also, the vector $\vec{OX}$ will be the normal vector to the tangent plane.
The plane passes $X$ so, the equation of the plane is
$$\alpha(x-\alpha)+\beta(y-\beta)+\gamma(z-\gamma)=0$$
Thus,$$\alpha x+\beta y+\gamma z=r^2$$
This plane passes through $P$ and $Q$, so plugging the values in gives us,
$$\alpha x_1+\beta y_1+\gamma z_1=r^2$$
$$\alpha x_2+\beta y_2+\gamma z=r_2^2$$
Overall, solve these three equations,
$$\alpha x_1+\beta y_1+\gamma z_1=r^2$$
$$\alpha x_2+\beta y_2+\gamma z_2=r^2$$
$$\alpha^2+\beta^2+\gamma^2=r^2$$
to get the values of $\alpha, \beta, \gamma$.
A: $$\alpha x_1 +\beta y_1+\gamma z_1=r^2  \ (1) $$
$$\alpha x_2 +\beta y_2+\gamma z_2=r^2 \ (2)  $$
$$\alpha^2+\beta^2+\gamma^2=r^2  \ (3)        $$
to get the values of $\alpha, \beta, \gamma$.
From (1) we have:
$$\alpha = \frac {r^2 - \beta y_1 - \gamma z_1}{x_1} (4) $$
input $\alpha$ in (2):
$$ \frac{x_2}{x_1}(r^2 - \beta y_1 - \gamma z_1) +\beta y_2+\gamma z_2=r^2$$
thus $$ \beta (y_2 - \frac{y_1 x_2}{x_1}) - \gamma ( \frac {z_1 x_2}{x_1} - z_2) = r^2 (1 - \frac{x_2}{x_1}) $$
or 
$$ \beta = A \gamma + B \ (5) $$
with $$ A =  \frac{\frac{z_1 x_2}{x_1} - z_2} {y_2 - \frac{y_1 x_2}{x_1}}
and  \ B = \frac{r^2 (1 - \frac{x_2}{x_1})}{y_2 - \frac{y_1 x_2}{x_1}}   $$
Reintroducing (5) in (4):
$$ \alpha = \frac{r^2 - (A \gamma + B) y_1 - \gamma z_1}{x_1} $$
$$ \alpha = \frac{\gamma (-A y_1 - z_1) + r^2 - B y_1}{x_1} $$
$$ \alpha = C \gamma + D (6) $$
 $$with C = \frac{-A y_1 - z_1}{x_1} and D = \frac{r^2 - B y_1}{x_1}  $$
I put (5) and (6) in (3):
$$ (C \gamma + D)^2 + (A \gamma + B)^2  +\gamma^2=r^2 $$
$$ \gamma^2 (C^2 + A2 + 1) + \gamma (2CD +2AB) + D^2 + B^2 - r^2 = 0 $$
by solving this second order equation we have two values for $\gamma$ and we can compute two values for $\beta$ with (5) and two values for $\alpha$ with (6). Unfortunately it does not work, i mean the computed values do not verify $\alpha^2 + \beta^2 + \gamma^2 = r^2$. It means there is at least error in my resolution but I cannot find it. If someone will be kind enough to check
