I have a unit vector $\mathbf{\hat{a}}\in\mathbb{R^3}$. I would like to calculate two new unit vectors $\mathbf{\hat{b}}$, $\mathbf{\hat{c}}$ which are perpendicular to $\mathbf{\hat{a}}$ and to each other, i.e. $$\mathbf{\hat{a}}\cdot\mathbf{\hat{b}}=\mathbf{\hat{a}}\cdot\mathbf{\hat{c}} = \mathbf{\hat{b}}\cdot\mathbf{\hat{c}} = 0.$$
It doesn't matter which direction $\mathbf{\hat{b}}$ and $\mathbf{\hat{c}}$ point in provided the above conditions are met.
Do you know the simplest way of doing this? One way to do this is to introduce a new vector $\mathbf{\hat{x}}$ which is the unit vector in the $x$-direction. Then let $$\mathbf{\hat{b}} = \mathbf{{\hat{x}}}\times\mathbf{\hat{a}},$$ $$\mathbf{\hat{c}} = \mathbf{\hat{a}}\times(\mathbf{{\hat{x}}}\times\mathbf{\hat{a}}).$$ However, this doesn't work if $\mathbf{\hat{a}}$ is parallel to $\mathbf{\hat{x}}$.
Is there a simpler/more elegant way of expressing this?
Edit: I am interested in the case where $\mathbf{\hat{a}} = \mathbf{\hat{a}}(x,y,z)$, where we can assume $\mathbf{\hat{a}}(x,y,z)$ is smooth. It would be nice if $\mathbf{\hat{b}}(x,y,z)$ and $\mathbf{\hat{c}}(x,y,z)$ were also smooth.
This bears on your question, although I'm not sure that it answers it fully:
Hairy ball theorem - Wikipedia