# Orthogonal Vectors in $R^n$ - Examples with Solutions

Orthogonal vectors are defined and examples are presented along with their detailed solutions.

## Orthogonal Vectors Definition

Two vectors $\textbf x = \begin{bmatrix} x_1 \\ x_2 \\ . \\ . \\ . \\ x_n \end{bmatrix}$ and $\textbf y = \begin{bmatrix} y_1 \\ y_2 \\ . \\ . \\ . \\ y_n \end{bmatrix}$ are orthogonal if and only if their inner product $\textbf x \cdot \textbf y$ is equal to zero.
Hence

Vectors $\textbf x$ and $\textbf y$ are orthogonal $\iff$ $\textbf x \cdot \textbf y = x_1 y_1 + x_2 y_2 + ... + x_n y_n = 0$

## Geometric Interpretation of Orthogonal Vectors

Below are shown two 2-dimensional vetors $\textbf x = \begin{bmatrix} 3 \\ 2 \end{bmatrix}$ and $\textbf y = \begin{bmatrix} -2 \\ 3 \end{bmatrix}$ whose inner product is given by $\textbf x \cdot \textbf y = (3)(-2)+(-2)(3) = 6 - 6 = 0$ and therefore are orthogonal. They make and angle of $90^{\circ}$ or $\dfrac{\pi}{2}$

Below are shown two 3-dimensional vetors $\textbf u = \begin{bmatrix} -2 \\ 2 \\ 3 \end{bmatrix}$ and $\textbf v = \begin{bmatrix} 2\\ -1 \\ 2 \end{bmatrix}$ whose inner product is given by $\textbf x \cdot \textbf y = (-2)(2)+(2)(-1) +(3)(2) = -4 - 2 + 6 = 0$ and therefore are orthogonal. They make and angle of $90^{\circ}$ or $\dfrac{\pi}{2}$

## Examples With Solutions

Example 1
a) Are the vectors $\textbf x = \begin{bmatrix} -1 \\ 3 \\ 1 \end{bmatrix}$ and $y = \begin{bmatrix} -2 \\ 3 \\ -11 \end{bmatrix}$ orthogonal?

b) Are the vectors $\textbf u = \begin{bmatrix} 0 \\ -3 \\ 1 \\ 8 \end{bmatrix}$ and $\textbf v = \begin{bmatrix} 3 \\ 5 \\ -2 \\ 2 \end{bmatrix}$ orthogonal?

Solution to Example 1
a)
The inner product of vactors $\textbf x$ and $\textbf y$ is given by
$\textbf x \cdot \textbf y = = (-1)(-2)+(3)(3)+(1)(-11) = 2 +9 -11 = 0$
The inner product is equal to zero and therefore the two vectors $\textbf x$ and $\textbf y$ are orthogonal.
b)
The inner product of vactors $\textbf u$ and $\textbf v$ is given by
$\textbf u \cdot \textbf v = = (0)(3) + (-3)(5) + (1)(-2) + (8)(2) = 0 -15 -2 + 16 = -1$
The inner product is NOT equal to zero and therefore the two vectors $\textbf x$ and $\textbf y$ are NOT orthogonal.

Example 2
Let vectors $\textbf u = \begin{bmatrix} 1\\ 0 \\ -1 \end{bmatrix}$ , $\textbf v = \begin{bmatrix} -2 \\ 1 \\ -2 \end{bmatrix}$ . Find a vector $\textbf w$ that is orthogonal to vectors $\textbf u$ and $\textbf v$.
Solution to Example 2
Using determinants of matrices, the cross product of vectors $\textbf u = \begin{bmatrix} u_x \\ u_y \\ u_z \end{bmatrix}$ and $\textbf v = \begin{bmatrix} v_x \\ v_y \\ v_z \end{bmatrix}$ is a vector defined by:

$\textbf u \times \textbf v = {\begin{vmatrix} 1& 1 & 1 \\ u_x & u_y & u_z \\ v_x & v_y & v_z \end{vmatrix}} = \begin{bmatrix} {\begin{vmatrix} u_y & u_z \\ v_y & v_z \end{vmatrix}}\\ - {\begin{vmatrix}u_x & u_z\\ v_x & v_z\end{vmatrix}} \\ {\begin{vmatrix}u_x & u_y\\ v_x & v_y\end{vmatrix}} \end{bmatrix}$

that is
orthogonal to both vectors $\textbf u$ and $\textbf v$.
Hence one way to find vector $\textbf w$ orthogonal to vectors $\textbf u$ and $\textbf v$ is to calculate the cross product as defined above.
$\textbf w = \begin{bmatrix} {\begin{vmatrix} 0& -1 \\ 1 & -2 \end{vmatrix}}\\ - {\begin{vmatrix} 1 & -1 \\ -2 & -2\end{vmatrix}} \\ {\begin{vmatrix}1 & 0\\ -2 & 1\end{vmatrix}} \end{bmatrix} = \begin{bmatrix} 1\\ 4\\ 1 \end{bmatrix}$

Note that all vectors parallel to vector $\textbf w$ which are of the form $k \textbf w$ , where $k$ is an integer, are orthogonal to the vectors $\textbf u$ and $\textbf v$.
As an exercise, check that any vector given by $k \textbf w$ is orthogonal to both vectors $\textbf u$ and $\textbf v$.

Example 3
Find the constants $a$ and $b$ such that the vectors $\textbf u \begin{bmatrix} a\\ 4 \\ -b \end{bmatrix}$ and $\textbf u \begin{bmatrix} a\\ 1 \\ b \end{bmatrix}$ are orthogonal and $a = b + 1$.
Solution to Example 3
Vectors $\textbf u$ and $\textbf v$ are orthogonal, hence their inner product is equal to zero
$a^2 + 4 - b^2 = 0$
Given that $a = b + 1$,substitute $a$ by $b + 1$ in the above equation
$(b+1)^2 + 4 - b^2 = 0$
Expand the above equation and simplify
$2 b + 5 = 0$
Solve for $b$
$b = -\dfrac{5}{2}$
Find $a$
$a = b + 1 = -\dfrac{5}{2} + 1 = -\dfrac{3}{2}$
Hence vectors $\textbf u$ and $\textbf v$ defined above are orthogonal for $a = -\dfrac{3}{2}$ and $b = -\dfrac{5}{2}$ .

Example 4
$\textbf u$, $\textbf v$ and $\textbf w$ are vectors in $R^n$ such that $\textbf w = \textbf v - 4 \alpha \textbf u$ where $\alpha$ is a real number.
Find $\alpha$ if $\textbf u$ and $\textbf w$ are orthogonal, the norm of $\textbf u$ is equal to 5 and $\textbf u^T \textbf v = 3$.
Solution to Example 4
Since $\textbf u$ and $\textbf w$ are orthogonal, their inner product is equal to zero; hence
$\textbf u \cdot \textbf w = 0$
Given that $\textbf w = \textbf v - 4 \alpha \textbf u$, substitute $\textbf w$ by $\textbf v - 4 \alpha \textbf u$ in the above equation
$\textbf u \cdot (\textbf v - 4 \alpha \textbf u) = 0$
Use distributivity and associativity of inner product to expand the left side of the above equation
$\textbf u \cdot \textbf v - 4 \alpha \textbf u \cdot \textbf u = 0$         (I)
The expression $\textbf u^T \textbf v$ is another form in writing the inner product of $\textbf u$ and $\textbf v$ ; hence
$\textbf u \cdot \textbf v = \textbf u^T \textbf v = 3$
The norm of a vector is defined as
$||\textbf u|| = \sqrt {\textbf u \cdot \textbf u}$
Given that the norm of $\textbf u$ written as $||\textbf u||$ is given and equal to 5, we have
$\textbf u \cdot \textbf u = ||\textbf u||^2 = 5^2$
Substitute $\textbf u \cdot \textbf v$ and $\textbf u \cdot \textbf u$ by their values in equation (I) above to obtain
$3 - 4 \alpha (25) = 0$
Solve the above equation for $\alpha$ to obtain
$\alpha = \dfrac{3}{100}$

Example 5
Find all values of $\theta$ such that the vectors $\textbf u \begin{bmatrix} \sin(\theta) \\ \cos(\theta) \end{bmatrix}$ and $\textbf v \begin{bmatrix} -1 \\ 1 \end{bmatrix}$ are orthognal.
Solution to Example 5
For the vectors $\textbf u$ and $\textbf v$ to be orthogonal, the inner product must be equal to 0. Hence
$\sin(\theta) (-1) + \cos(\theta) (1) = 0$
The above equations may be written as
$\sin(\theta) = \cos(\theta)$
Divide both sides of the above equation by $\cos(\theta)$
$\dfrac{\sin(\theta)}{\cos(\theta)} = \dfrac{\cos(\theta)}{\cos(\theta)}$
Simplify and rewrite as
$\tan (\theta ) = 1$
Solve for $\theta$
$\theta = \dfrac{\pi}{4} + n \pi$

Example 6
Let $\textbf u = \begin{bmatrix} \sin(\theta) \cos (\phi) \\ \sin(\theta) \sin (\phi) \\ \cos (\theta) \end{bmatrix}$ , $\textbf v = \begin{bmatrix} \cos(\theta) \cos (\phi) \\ \cos(\theta) \sin (\phi) \\ -\sin (\theta) \end{bmatrix}$ and $\textbf w = \begin{bmatrix} -\sin (\phi) \\ \cos (\phi) \\ 0 \end{bmatrix}$. Proove that each of these vectors is orthogonal to the other two vectors.
Solution to Example 7
We calculate the inner product of each pair of vectors
$\textbf u \cdot \textbf v = [\sin(\theta) \cos (\phi)] \; [\cos(\theta) \cos (\phi)] + [\sin(\theta) \sin (\phi)] \; [\cos(\theta) \sin (\phi)] + [\cos (\theta)] \; [-\sin (\theta)]$
Factor $\sin(\theta) \cos(\theta)$ out of the first and second terms
$= [\sin(\theta) \cos(\theta) ] \; [\cos^2 (\phi) + \sin^2 (\phi)] - \cos (\theta) \sin (\theta)$
Use the identity $\cos^2 (\phi) + \sin^2 (\phi) = 1$ to simplify
$= \sin(\theta) \cos(\theta) - \cos (\theta) \sin (\theta) = 0$

$\textbf u \cdot \textbf w = [\sin(\theta) \cos (\phi)] \; [-\sin (\phi)] + [\sin(\theta) \sin (\phi)] \; [\cos (\phi)] +[\cos (\theta)][0]$
Factor $\sin(\theta) \cos(\phi)$ out of the first and second terms and simplify
$= [ \sin(\theta) \cos(\phi) ] \; [ -\sin (\phi) + \sin (\phi)] + 0 = 0$

$\textbf v \cdot \textbf w = [\cos(\theta) \cos (\phi)] \; [-\sin (\phi)] + [\cos(\theta) \sin (\phi)] \; [\cos (\phi)] +[-\sin (\theta)] \; [0]$
Factor $\cos(\theta) \cos(\phi)$ out of the first and second terms and simplify
$= [ \cos(\theta) \cos(\phi) ] \; [ -\sin (\phi) + \sin (\phi)] + 0 = 0$
The inner product of each pair of vectors is equal to zero and therefore each vector is orthogonal to the other two vectors.