# Thread: 3D Unit Normal, Finding the 3rd Component

1. ## 3D Unit Normal, Finding the 3rd Component

Hi,
I'm trying to find the z component of a unit normal of a plane given the x and y components.

Since it's a unit normal I know that I have $n_x^2 + n_y^2+n_z^2 = 1$, therefore, $n_z = \sqrt{1 - n_x^2 - n_y^2}$.

This seems fine in testing, until a case where $n_z$ should be negative, at which point the world breaks! Am I doing something stupid here? It's worth mentioning that I'm doing this as part of an image-plane to world-plane correction and as such don't have any coordinates of points on the world-plane itself. The only information I have is a set of image-plane coordinates.

Thanks!

2. Actually, you must have $n_{z}=\pm\sqrt{1-n_{x}^{2}-n_{y}^{2}}.$ Do you know ahead of time when you need the positive and when you need the negative?

3. Sorry, I forgot the +/-. I don't unfortunately, this is my problem. I was wondering if there was some way I'd missed to determine the sign.

Given that I'm going to be using Broyden's method to approximate $n_x$ and $n_y$ as well as 2 other variables, I starting to think it might just be worth putting $n_z$ in as a 5th variable to approximate.

4. I just realised, $n_z$ is going to be a half plane anyway, as you can't look behind the camera from a camera!