# Getting Z coordinates from 3 vectors knowing their X, Y coordinates

Hi!,

I have 3 vectors with origin in (0,0,0). I have their x, y coordinates (x1, y1, x2, y2, x3 and y3) and i want to know its z coordinates (z1, z2 and z3). Don’t worry, i have another data: between themselves are perpendiculars. So they are forming 90 degrees angles between them.

As you know this is called a base.

Maybe i could solve this problem with scalar product equations:

x1x2 + y1y2 + z1z2=0
x1
x3 + y1y3 + z1z3=0
x2x3 + y2y3 + z2*z3=0

I have even draw this base:

Vector 1 --> (3,2,0)
Vector 2 --> (0,3,0)
Vector 3 --> (0,2,4)

(if you draw it, you will see they are perpendiculars)

But when i catch only their x and y coordinates:

(3,2)
(0,3)
(0,2)

and use the equations above, they dont solve the z coordinates correctly…

I have even thought to solve the problem from a prism (from a base you can create a prism) with some geometrical computering application but i dont know how…

Any idea could be good.

Your idea to formulate a system of equations using the property of being pairwise orthogonal is indeed the right approach. Your sample values, however, can not fulfill this property, no matter what values z1, z2, and z3 have. In other words, you can’t solve this particular system of equations.

If you compute the scalar product between the three vectors you proposed, you’ll see they are indeed not perpendicular.

ok its true…

but these other:

(2,0,2)
(3,3,-3)
(4,-4,-4)

are perpendiculars.

And if you try to solve the equation with these values:

(2,0)
(3,3)
(4,-4)

you will not find the z values…

(3, 3, -3) and (4, -4, -4) are not perpendicular.

``````  3*4 + 3*(-4) + ((-3)*(-4)
= 12  - 12     + 12
= 12
``````

Let’s try a different example:

``````a = (0,  2, z1)
b = (0, -3, z2)
c = (2,  0, z3)

a.b = 0 - 6 + z1*z2 = 0 | neither z1 nor z2 can be zero
a.c = 0 + 0 + z1*z3 = 0 | z1 can't be zero, so z3 must be
b.c = 0 + 0 + z2*z3 = 0 | z2 can't be zero, so z3 must be

z3 = 0
z1 = 6 / z2  | we can choose either z1 or z2 freely

z2 = 2
z1 = 6 / 2 = 3

a = (0,  2, 3)
b = (0, -3, 2)
c = (2,  0, 0)
``````

Now, if you try these three vectors, you’ll see they are indeed pairwise perpendicular.