Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

This seems to me as a very simple and basic question, though I'm having trouble with it.

The Problem

Given a sphere $K\in\mathbb{R}^n$ with radius $r\in\mathbb{R}$ and center $\vec{c}\in\mathbb{R}^n$: $$K:||\vec{x}-\vec{c}||_2^2=r^2$$

And a given line along $\vec{n}\in\mathbb{R}^n$, $||\vec{n}||_2=1$ through $\vec{x}\in\mathbb{R}^n$: $$g: \vec{x}+\vec{n}d$$

Substituting the line into the equation of $K$ gives $$||\vec{x}+\vec{n}d-\vec{c}||_2^2=r^2$$ which results in the quadratic equation $$\sum_{i=1}^{n}(x_i+n_id-c_i)^2-r^2=0$$

Within my problem, it is ensured, that the supporting vector $\vec{x}$ of the line is always within the sphere. With my understanding, this simplifies the solutions of the quadratic equation in such a way, that there are always two solutions for $d$.

The Question

And this is the point, where I got stuck. How can this be rewritten either by using the quadratic formula ($ax^2+bx+c=0 \Rightarrow x_{1,2}=\frac{-b\pm\sqrt{b^2-4ac}}{2a^2}$) or as a system of equations?

Any help is appreciated. Thank you.

share|improve this question
This has nothing to do with spherical geometry which, perhaps confusingly, is quite unrelated to the geometry of spheres :) –  Mariano Suárez-Alvarez Jun 21 '11 at 13:09
Oh, thank you for this remark, @Mariano. I've deleted that tag. –  Torbjoern Jun 21 '11 at 13:12

1 Answer 1

up vote 3 down vote accepted



Now you can solve for $d$.

If you're familiar with dot product the whole thing can be simplified. $$(\vec nd+\vec x- \vec c).(\vec nd+\vec x- \vec c)=r^2$$

$$d^2 \vec n.\vec n + 2d\vec n.(\vec x-\vec c)+(\vec x-\vec c).(\vec x-\vec c)=r^2$$

$$d^2 \|\vec n\|^2 + 2d\vec n.(\vec x-\vec c)+\|\vec x-\vec c\|^2=r^2$$

share|improve this answer
Thanks a lot. It was easy, as I thought. –  Torbjoern Jun 22 '11 at 14:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.