Given vector $\vec x = \left\{ x_i\right\}_{i=1}^n$ find an algebraic expression for $\vec y = \left\{ x^2_i\right\}_{i=1}^n$ Given vector 
$$\vec x = \begin{bmatrix} x_1 \\ \vdots \\ x_n \end{bmatrix},$$
How can we write out vector 
$$\vec y =  \begin{bmatrix} y_1 \\ \vdots \\ y_n \end{bmatrix} := \begin{bmatrix} x^2_1 \\ \vdots \\ x^2_n \end{bmatrix}$$ 
in terms of $\vec x$ using only matrix operations? 
It is simple to write $\vec y$ in terms of $\vec x$ element wise, for example in the form of system of equations $y_i = x_i^2$ for $i = 1, \dots, n$.
However, I am struggling to do so using matrix notation and operations.
The best guess I could come up with was to write expressions like 
$$
\begin{aligned}
\vec y &= \vec x ^T \cdot I_{n \times n} \cdot\vec x, 
& I_{n \times n}  -\text{ identity matrix,  } &
& I_{n \times n} & =
\begin{bmatrix} 
1 & 0 & \cdots & 0 \\ 
0 & 1 & \cdots & 0 \\ 
\vdots & \vdots & \ddots & \vdots \\ 
0 & 0 & \cdots & 1 \\ \end{bmatrix} 
\\
\vec y &= \left\langle \vec x, \vec x \right \rangle 
= \left\| \vec x \right\|
& - \text{ inner product / norm,  } &
& \left\| \vec x \right\| &= \left\langle \vec x, \vec x \right \rangle  = 
\sum_{i=1}^{n} x_i^2
\end{aligned}
$$
both of which are obviously flawed.
Any hint would be appreciated.
 A: Note: It's not clear what "using only matrix operations" means. What motivation do you have for this computation? From a normal geometric point of view, this isn't a natural thing to do because it's basis dependent. 
But assuming we're happy to choose the privileged basis $$\vec{e}_1 = (1,0,0), \quad \vec{e}_2 = (0,1,0), \quad \vec{e}_3 = (0,0,1)$$ since we have to do something to break the symmetry under changes of basis, we can write the answer as follows:
$$\vec{y} = (\vec{e}_1 \cdot \vec{x})^2 \vec{e}_1 + (\vec{e}_2 \cdot \vec{x})^2 \vec{e}_2 + (\vec{e}_3 \cdot \vec{x})^2 \vec{e}_3$$
If you prefer, you could write this as
$$\vec{y} = \left(
(\vec{e}_1^\dagger \vec{x}) (\vec{e}_1 \vec{e}_1^\dagger)
+(\vec{e}_2^\dagger \vec{x}) (\vec{e}_2 \vec{e}_2^\dagger)
+(\vec{e}_3^\dagger \vec{x}) (\vec{e}_3 \vec{e}_3^\dagger)
 \right) \vec{x}$$
which evaluates to
$$\vec{y} = \left(
x_1 \pmatrix{1 & & \\ & 0 &  \\ & & 0}
+x_2 \pmatrix{0 & & \\ & 1 &  \\ & & 0}
+x_3 \pmatrix{0 & & \\ & 0 &  \\ & & 1}
 \right) \vec{x}$$
as mentioned in another answer.
A: What you are looking for is a vector-valued bilinear form. 
Let $B$ be a bilinear form from $\mathbb{R}^n \times \mathbb{R}^n$ into $\mathbb{R}^n$, such that, for all $i,j,k\in\{1,\cdots n\}$, 
$B_{i,j}^k =1$ if $i=j=k$
and 
$B_{i,j}^k =0$  otherwise
Then you have $\vec{y} = B(\vec{x},\vec{x})$. 
In terms of coordenates: $y_k=\sum_{i,j=1}^{n}B_{i,j}^k x_i x_j=(x_k)^2$
Remark: If you want to think of $B$ as a vector of matrices, it is 
$$B = \left(
 \pmatrix{1 & & \\ & 0 &  \\ & & 0},
 \pmatrix{0 & & \\ & 1 &  \\ & & 0},
\pmatrix{0 & & \\ & 0 &  \\ & & 1}
 \right) $$
And the rule to apply it to vectors $\vec{v}$ and $\vec{w}$ is
$$B(\vec{v},\vec{w}) = \left(
 \vec{v}^T \pmatrix{1 & & \\ & 0 &  \\ & & 0}\vec{w},
\vec{v}^T \pmatrix{0 & & \\ & 1 &  \\ & & 0}\vec{w},
\vec{v}^T\pmatrix{0 & & \\ & 0 &  \\ & & 1}\vec{w}
 \right) $$
Note that this way to write $B$ and to write $B(\vec{v},\vec{w})$ generalizes to any bilinear form from $\mathbb{R}^n \times \mathbb{R}^n$ into $\mathbb{R}^n$.  
A: $\begin{pmatrix}
x_1 & 0 & 0\\
0 & x_2 & 0\\
0 & 0 & x_3\\
\end{pmatrix}\begin{pmatrix}x_1\\x_2\\x_3\end{pmatrix}=\begin{pmatrix}x_1^2\\x_2²\\x_3^2\end{pmatrix}$
