Moving terms of the equation to the left hand side

whatever

New member
I am looking at a book about ray-tracing and there is this equation about a ray intersecting a sphere.
It shows this equation:

dot((A + t*B - C),(A + t*B -C)) = R*R

Which I think I understand. Now by moving terms of the equation to the left hand side it becomes this:

t*t*dot(B,B + 2*t*dot(B,A-C) + dot(A-C,A-C) - R*R=0

Could somebody explain what steps are taken to achieve this? I understand moving - R*R to the left and then getting 0 after = but that's about it.
I think moving the terms is necessary to get the t out of the dot product as t is the one variable that is unknown for this case.

Hope this falls under Arithmetic.
Help much appreciated.

Last edited:

Dr.Peterson

Elite Member
This would probably be called advanced algebra. It definitely is not arithmetic when it involves vectors.

Apparently this is talking about a computer system where dot(X,Y) returns the dot product of vectors X and Y. Using more standard notation, what they have done is to rewrite $$\displaystyle A+tB - C$$ as $$\displaystyle (A-C) + tB$$ and distribute $$\displaystyle ((A-C) + tB)\cdot((A-C) + tB)$$. Give that a try.

But be sure to correct the imbalanced parentheses first.

whatever

New member
Thank you very much for your response.

Hhhmmm., unbalanced parentheses when asking a question; that's not the smartest thing to do. Sorry about that.
I believe it is balanced like this:
t*t*dot(B,B) + 2*t*dot(B,A-C) + dot(A-C,A-C) - R*R=0

So, after reading your response, I start out with:

dot((A + t*B - C),(A + t*B -C)) = R*R

I can move R*R to the left to get:

dot((A + t*B - C),(A + t*B -C)) - R*R = 0

Then I do your suggested rewrite:

dot((A - C) + t*B),((A -C) + t*B) - R*R = 0

But then I am stuck again. I possibly don't get the distribute part...
Help much appreciated.

Dr.Peterson

Elite Member
Are you not familiar with the distributive property?

Just as with numbers, a(b+c) = ab + ac, and (a+b)(c+d) = ac + ad + bc + bd, the same is true of the dot product.

Give it a try. Possibly your functional notation for the dot product as dot(A, B) is making it hard for you to see what you can do. In that form, dot(A+B, C+D) = dot(A,C) + dot(A, D) + dot(B, C) + dot(B, D).

whatever

New member
Thank you very much for your response.
I was mainly having problems with not realizing that I could just pull t from an element in the dot product and multiply the result of the dot product like that. Furthermore, for some reason, I wasn't realizing that dot(A,B) gives the same output as dot(B,A).

So if I am not mistaken the steps are as follows:
dot((A + t*B - C),(A + t*B -C)) = R*R

dot((A + t*B - C),(A + t*B -C)) - R*R = 0 // move R*R to the left hand side

dot((A - C) + t*B),((A -C) + t*B) - R*R = 0 // change dot(A + t*B - C) to dot((A -C) + t*B)

dot(A - C, A - C) + dot(A - C, t*B) + dot(t*B, A - C) + dot(t*B, t*B) - R*R = 0 //distribute the dot products

dot(A - C, A - C) + t*dot(A - C, B) + t*dot(B, A - C) + t*t*dot(B, B) - R*R = 0 // pull t out of the dot products

dot(A - C, A - C) + 2*t(B, A - C) + t*t*dot(B, B) - R*R = 0 // shrink t*dot(B, A -C) and t*dot(A - C, B) to 2*t*dot(B, A - C)

t*t*dot(B, B) + 2*t*dot(B, A - C) + dot(A - C, A - C) - R*R = 0 // the outcome was in different order but the result would be the same

Dr.Peterson

Elite Member
Looks good. Knowing what commutes, and other properties like the interaction of scalar multiplication with dot product is important.

This is why we ask you to show your work from the start, so we don't have to waste time finding out what you have done and where you are stuck.

I have to ask, is there a reason you have to use that clunky function notation?

whatever

New member
There is no need for me to use that clunky notation. It is written down like that in the book I am reading.
Anyway thank you for getting me to figure this out...