Consider the following problem and its answer:

Given 3 points in 3D: $A=(A_x,A_y,A_z); B=(B_x,B_y,B_z) ; C=(C_x,C_y,C_z)$

Find the transformation matrix (in homogeneous coordinates) that performs a reflection around the plane spanned by the given 3 points.


enter image description here

  1. Can anyone explain why this answer is correct?
  2. Shouldn't normalization be performed by dividing by $|C-A|$ and $|B-A|$ instead of $|AC|$ and $|AB|$?
  3. Wouldn't we want to reflect on $uv$ plane (and then the -1 would be one row below)?
  4. I saw a similar question where you had to rotate around a vector and not a surface, and then we created $v$ with $v=u\times(0,0,1)^T$ (the vector was $P_1-P_0$ and $u=\dfrac{P_1-P_0}{|P_1-P_0|}$. What's the difference?
  5. In general, what is the rule of thumb when finding the $u,v,z$ cartesian system of a given object (plane, line, point etc)?
  • 1
    $\begingroup$ Seems to me that $|AC|$ is just shorthand for length of vector A to C which is $|C-A|$ or $|A-C|$ which is your second question. If so then this does work. For you to uderstand why you would need to draw the images of the vectors but im not able to do that on mobile phone. $\endgroup$
    – joojaa
    Aug 27, 2016 at 5:49

1 Answer 1


The answer in the screenshot is wrong on two counts. First, you're correct that in the middle matrix the −1 should be on the third row, not the second. The other error is that the $u, v$ basis vectors are normalized, but not orthogonalized, so $M$ is not in general a rotation matrix; therefore its inverse is not simply its transpose. (The reflection doesn't actually need an orthonormal basis, so you could fix the answer either way: by using the full inverse for $M$, or by fully orthonormalizing $u$ and $v$.)

The rule of thumb for setting up a local coordinate system (I assume orthonormal) for a given object is to set some of the axes to be lined up with the object, then choose arbitrary perpendicular vectors for any remaining axes.

  • For a point, there's nothing to line up with, so you can use any arbitrary axes.
  • For a line, you line up the $u$ axis with the line, then there's nothing to constrain the $v$ axis, so you can choose any arbitrary vector perpendicular to $u$. That's what the $v=u\times(0,0,1)^T$ thing was getting at: it's a convenient formula to get some vector perpendicular to $u$ if you don't otherwise care what direction it is. Except that this won't work if $u$ happens to be parallel to the z-axis (the cross product returns zero then), so you actually need to detect that and switch to a different formula, such as $v=u\times(1,0,0)^T$, in that case.
  • For a plane, you line up the $u$ and $v$ axes with the plane. So, you can pick any arbitrary $u$ that lies in the plane, then find a $v$ that lies in the plane and is perpendicular to $u$.

Addendum on orthonormalization

Suppose you have a couple of 3D vectors $u, v$ that are non-parallel (linearly independent) but otherwise arbitrary, and you want to generate a 3D orthonormal basis $u', v', w'$ from them. There are two equivalent ways to do it.

  1. Use the Gram–Schmidt process. This works as follows: first, normalize $u$. Then, for each additional vector, subtract off its projection onto the previous vectors, and normalize what's left over. For the 3D case this looks like: $$ \begin{aligned} u' &= \text{normalize}(u) = \frac{u}{|u|} \\ v' &= \text{normalize} \bigl( v - (u' \cdot v)u' \bigr) \\ w' &= u' \times v' \end{aligned} $$ Note that the notation $(u' \cdot v)u'$ means take the dot product of $u'$ with $v$ (giving a scalar), then multiply that scalar by $u'$. This gives the vector component of $v$ that is parallel to $u'$. When this is subtracted from $v$, the remaining component is perpendicular to $u'$.

    Finally, $w'$ is set to the cross product of $u'$ and $v'$ to ensure the basis is right-handed. Since $u', v'$ are already orthonormal, we don't need to normalize $w'$—it comes out already normalized. (This isn't strictly part of the Gram–Schmidt process.)

    By the way, the Gram–Schmidt process works for making an orthonormal basis in any number of dimensions, not just two or three.

  2. The other way, which only works in 3D, is to use cross products. $$ \begin{aligned} u' &= \text{normalize}(u) \\ w' &= \text{normalize}(u' \times v) \\ v' &= w' \times u' \end{aligned} $$ Here, $w'$ has to be normalized because $u'$ and $v$ are not orthonormal. But then $u'$ and $w'$ are orthonormal, so we can calculate $v'$ from them without a normalize. This gives the same results as the previous process, so it's up to you which you prefer to use.

  • $\begingroup$ I was thinking about the mirror row and it is possible that we are seeing a slightly malformed version of the original question. In which case it could be correct. $\endgroup$
    – joojaa
    Aug 27, 2016 at 8:46
  • $\begingroup$ @joojaa Why do you think the question is a malformed version? $\endgroup$
    – Jjang
    Aug 27, 2016 at 10:06
  • $\begingroup$ @Nathan, Thanks alot. Although I'm left with several questions: 1. Can you clarify "You could fix the answer either way.. fully orthonormalizing u and v.") ? How do I fully orthonormalize u and v? That is also a question regarding bullet #3 of your answer. Would leaving $u$ as it is and setting $v=u\times|B-A|$ satisfies the requirement? If not, can you please show me explicitly? 2. So for a point I can use anything, even $(1,0,0),(0,1,0),(1,0,0)$? 3. Regarding the normalization with $|AC|$, so is it correct? or it should be $|C-A|$? Because I'm not sure the first one is a shorthand. $\endgroup$
    – Jjang
    Aug 27, 2016 at 10:16
  • 1
    $\begingroup$ @jiang because its a trivial error and depends on exact wording of the problem it is eady to construct a sentence where the 2 solutions would ony differ by a two letter preposition. $|AC|$ is perfectly normal shorthand in literature. $\endgroup$
    – joojaa
    Aug 27, 2016 at 11:15
  • 1
    $\begingroup$ @Jjang For orthonormalization, look at the Gram–Schmidt process. Briefly, you'd start with $v = B - A$, then set $v' = v - (u \cdot v)u$. This subtracts off the component of $v$ that's parallel to $u$, leaving only the perpendicular component. Then you normalize $v'$. And joojaa is right, $|AC|$ is common shorthand for the distance between $A$ and $C$. $\endgroup$ Aug 27, 2016 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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