# Example Problems

Show that the inner product defined above for $$\mathbb{R}^n$$ as $$\langle \vec{x}, \vec{y}\rangle = x\_1y\_1 + x\_2y\_2 + \cdots + x\_ny\_n$$ fulfills the 4 properties of an inner product.

Let $$\vec{x}, \vec{y}, \vec{z} \in \mathbb{R}^n$$ and $$\alpha \in \mathbb{R}$$.

1. $$\begin{align\*}\langle \vec{y}, \vec{x}\rangle &= y\_1x\_1 + y\_2x\_2 + \cdots + y\_nx\_n \ &= x\_1y\_1 + y\_2x\_2 + \cdots + x\_ny\_n \ &= \langle \vec{x}, \vec{y}\rangle\end{align\*}$$
2. $$\begin{align\*}\langle \vec{x}, \vec{y} + \vec{z}\rangle &= x\_1(y\_1 + z\_1) + x\_2(y\_2 + z\_2) + \cdots + x\_n(y\_n + z\_n) \ &= x\_1y\_1 + x\_2y\_2 + \cdots + x\_ny\_n + x\_1z\_1 + x\_2z\_2 + \cdots + x\_nz\_n \ &= \langle \vec{x}, \vec{y}\rangle + \langle \vec{x}, \vec{z}\rangle\end{align\*}$$
3. $$\begin{align\*}\langle \alpha\vec{x}, \vec{y}\rangle &= \alpha x\_1y\_1 + \alpha x\_2y\_2 + \cdots + \alpha x\_ny\_n \ &= \alpha(x\_1y\_1 + x\_2y\_2 + \cdots + x\_ny\_n) \ &= \alpha \langle \vec{x}, \vec{y}\rangle\end{align\*}$$
4. $$\langle \vec{x}, \vec{x}\rangle = x\_1^2 + x\_2^2 + \cdots x\_n^2$$.

   Since every component is squared, we know that $$\langle \vec{x}, \vec{x}\rangle \geq 0$$. Let us check when $$x\_1^2 + x\_2^2 + \cdots x\_n^2 = 0$$. Since we are adding each component squared, all components must be $$0$$ in order for this sum to be $$0$$ as well, i.e. $$\vec{x}$$ must be the zero vector. Therefore, $$\langle \vec{x}, \vec{x}\rangle = 0 \iff \vec{x} = \vec{0}$$.

## Norm

The norm of a vector $$\vec{x} \in V$$ is its length. We denote the norm as $$|\vec{x}|: V \rightarrow \mathbb{R}$$.

For vectors in $$\mathbb{R}^n$$, to find the length of a vector $$\vec{x} = \begin{bmatrix}x\_1 \ x\_2 \ \vdots \ x\_n\end{bmatrix}$$, we use the Pythagorean theorem.

$$|\vec{x}| = \sqrt{x\_1^2 + x\_2^2 + \cdots + x\_n^2} = \sqrt{\langle \vec{x}, \vec{x}\rangle}$$

Therefore, we can express the inner product of $$\vec{x}$$ with itself as the square of its norm:

$$\langle \vec{x}, \vec{x}\rangle = |\vec{x}|^2$$

### Properties

Norms have to fulfill 3 properties for $$\vec{x}, \vec{y} \in V$$ and $$\alpha \in \mathbb{R}$$:

1. Nonnegativity: $$|\vec{x}| \geq 0$$, where $$|\vec{x}| = 0$$ if and only if $$\vec{x} = \vec{0}$$
2. Scaling: $$|\alpha \vec{x}| = |\alpha||\vec{x}|$$
3. Triangle inequality: $$|\vec{x} + \vec{y}| \leq |\vec{x}| + |\vec{y}|$$, where $$|\vec{x} + \vec{y}| = |\vec{x}| + |\vec{y}|$$ if and only if $$\vec{x} = \alpha\vec{y}$$ (i.e. when $$\vec{x}$$ and $$\vec{y}$$ are parallel)

## Angle

We define the angle $$\theta$$ between 2 vectors $$\vec{x}, \vec{y}$$ using the following equation:

$$\langle \vec{x}, \vec{y}\rangle = |\vec{x}||\vec{y}|\cos\theta$$

$$\cos\theta = \frac{\langle \vec{x}, \vec{y}\rangle}{|\vec{x}||\vec{y}|}$$

![Angle between 2 vectors](https://upload.wikimedia.org/wikipedia/commons/2/25/Scalar-product-dot-product.svg)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ee16a.gitbook.io/studee16a/linear-algebra/inner-products/example-problems.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
