Question: 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.

Answer: 
*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.
$\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}$