How to reproduce 3d image of Householder Reflection similar to given in Tikz

I am just getting started using Tikz and I am having some trouble. There is an image

that I think is perfect that I am trying to recreate in Tikz. I tried to define a plane and also tried looking at Drawing a Plane in 3D space but everything in Tikz seems too specific and I can't seem to find a general guide that might help me figure out how to draw something like this. As a new user it is very daunting. Everything that I have tried so far has come out looking completely wrong.

Any help would be appreciated!!

• Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
– Community Bot
Sep 29, 2022 at 6:00
• Welcome to TeX.SX! If the image is only schematic (which I assume), it is probably not necessary to use 3D mechanics for drawing. So, I would first just draw a the skewed grey rectangle and than add the arrows with the labels. But since you say, that you tried something, it would be better to show this, so we can know which problems exactly you face. Sep 29, 2022 at 6:06

Welcome to TeX.SX! I don't think that you really need any libraries for that, as plain TikZ already comes with some basic 3D drawing tools. Maybe the following can help you (explanations as comments in the code):

\documentclass[border=10mm]{standalone}
\usepackage{tikz}

\begin{document}

% you can use the options x, y and z to declare your coordinate system,
% for example, x={(20:10mm)} means "1 on the x axis be at coordinate (20:10mm) on the canvas"
% (of course, you can also use cartesian coordinates to define x, y and z)
\begin{tikzpicture}[x={(20:10mm)}, y={(100:15mm)}, z={(5:10mm)}, >=stealth]

% first, we draw the plane keeping the y coordinate at zero:
\fill[black!10] (-2,0,-1) -- (-2,0,1) --  (2,0,1) -- (2,0,-1) -- cycle;

% then, we define some coordinates:
\coordinate (o) at (0,0,0);
\coordinate (a) at (0,1,0);
\coordinate (b) at (1,0,0);
\coordinate (c) at (1,-1,0);
\coordinate (x) at (1,1,0);

% finally, we draw the arrwos by connecting the coordinates and attach labels
\draw[very thick, ->] (o) -- (0,.33,0) node[midway, left] {$u$};
\draw[thick, ->, gray] (o) -- (a) node[black, left] {$(u^Hx)u$};
\draw[thick, ->, green] (o) -- (b) node[black, right] {$x-(u^Hx)u$};

\draw[thick, ->, red] (o) -- (x) node[black, above right] {$x$};
\draw[gray] (a) -- (x);

\draw[thick, ->, gray, dashed] (x) -- (b) node[black, midway, right, font=\scriptsize] {$-(u^Hx)u$};
\draw[thick, ->, gray, dashed] (b) -- (c) node[black, midway, right, font=\scriptsize] {$-(u^Hx)u$};

\draw[thick, ->, blue] (o) -- (c) node[black, below] {$(I-2uu^H)x$};

\end{tikzpicture}

\end{document}


• Thank you so so much and yes I'm sorry for not including what I had made previously. Mostly it was based on trying to make small changes to other things on this SX and fully ruining them. This is really really helpful since the comments help me understand what is actually happening under the hood. Sep 29, 2022 at 21:09

I think TikZ (internally 2D) is enough to draw this simple task, see Jasper Habicht's answer above. The below is an alternative with 3D Asymptote. Do you see a Householder reflection by figure and by values ?

Note that in the OP's figure there is a mistake: (I-2u^H x)u instead of (I-2uu^H)x. Here the symbol H stands for Hermitian transpose, or conjugate transpose. In Asymptote, u^Hx is nothing but the scalar product dot(u,x).

// http://asymptote.ualberta.ca/
import three;
size(8cm);
currentprojection=orthographic(2,3,-1,center=true,zoom=.9);
triple u=(0,0,1), x=(0,2,2.5);
triple uh=u;
real uhx=dot(uh,x);
triple A=x-uhx*u;
triple B=uhx*u;
triple C=x-2*uhx*u;
draw(B--x,gray);
draw(Label("$-(u^Hx)u$",Relative(.5),align=E),x--A,gray+dashed,Arrow3);
draw(Label("$-(u^Hx)u$",Relative(.5),align=E),A--C,gray+dashed,Arrow3);
draw(Label("$x-(u^Hx)u$",EndPoint,align=E),O--A,orange+1pt,Arrow3);
draw(Label("$(u^Hx)u$",EndPoint,align=W),O--B,gray+1pt,Arrow3);
draw(Label("$u$",EndPoint,align=W),O--u,gray+1pt,Arrow3);
draw(Label("$\left(I-2u^Hx\right)u$",EndPoint,align=S),O--C,blue+1pt,Arrow3);
draw(Label("$x$",EndPoint,align=NE),O--x,red+1pt,Arrow3);
draw(shift(-1.5A-1.5X)*surface(plane(4A,3X)),blue+opacity(.1));

// to see numeric values
write("u = ",u);
write("x = ",x);
write("<u,x> = ",uhx);
write("x - <u,x> u = ",A);
write("<u,x> u = ",B);
write("x - 2 <u,x> u = ",C);


• Hah, I did not know what the diagram was actually all about. Did I even get the coordinates correctly? I just assumed the values from the OP's drawing. I think I got it right, if the green (yellow/orange in your case) arrow lies completely inside the plane. Sep 29, 2022 at 19:09