In a hexagonal crystal system, just like in any other three dimensional system, every vector can be represented in a basis consisting of 3 linearly independent vectors. Thus, 3 such vectors would be sufficient to describe any direction we want in a crystal.
The image below shows a hexagonal unit cell with 4 axes (represented by vectors): $\vec{a_1}$, $\vec{a_2}$, $\vec{a_3}$ and $\vec{z}$, used to index directions in a crystal. Vectors $\vec{a_1}$, $\vec{a_2}$ and $\vec{a_3}$ are $\mathit{not}$ linearly independent. Conventionally, we choose $\vec{a_3}$ to be the "extra" vector, and $\vec{a_1}$, $\vec{a_2}$, and $\vec{z}$ the "main" vectors, common to both 4 and 3 index systems.
The vector $\vec{a_3}$ is defined as $\vec{a_3} = -\left(\vec{a_1} + \vec{a_2}\right)$, which gives us some intuition for requiring $t = -(u+v)$ to be obeyed, since u,v and t are components along $\vec{a_1}, \vec{a_2}$ and $\vec{a_3}$, respectively. We could have used a different relation between $u$, $v$ and $t$, but this one is the most straightforward (we need an extra equation for the vector components to be unique since $\vec{a_1}$, $\vec{a_2}$ and $\vec{a_3}$ are not linearly independent).

The difference between the 3 index (denoted by [u'v'w']) and 4 index representations (denoted by [uvtw]) is that when using 3 indices, we ignore the vector $\vec{a_3}$, and only use $\vec{a_1}$, $\vec{a_2}$ and $\vec{z}$ (the $\mathit{same}$ $\vec{a_1}$, $\vec{a_2}$ and $\vec{z}$ in $\mathit{both}$ representations - the only difference is having or not having $\vec{a_3}$). Notice that $\vec{a_1}$ and $\vec{a_2}$ are $\mathbf{not}$ orthogonal. Instead, they make a $120^\circ$ angle, so they aren't the usual $\hat{x}$ and $\hat{y}$ vectors, but rather ones that respect the symmetry of the crsystal.
Now, any vector $\vec{v}$ can be written in both representations (again, note that the only difference between the two is $\vec{a_3}$ being present in 4-index notation and missing in 3-index notation):
$$\vec{v} = u'\vec{a_1} + v'\vec{a_2} + w'\vec{z} \tag{1} \label{1}$$
and
$$\vec{v} = u\vec{a_1} + v\vec{a_2} + t\vec{a_3} + w\vec{z} \tag{2} \label{2}$$
As $\vec{a_3} = -\left(\vec{a_1} + \vec{a_2}\right)$, inserting this into equation $\eqref{2}$ we get:
$$\vec{v} = (u-t)\vec{a_1} + (v-t)\vec{a_2} + w\vec{z}$$
By substituting $t = -(u+v)$ we further get
$$\vec{v} = (2u+v)\vec{a_1} + (2v+u)\vec{a_2} + w\vec{z} \tag{3} \label{3}$$
Equating the components along the same vectors from $\eqref{3}$ and $\eqref{1}$ we get
$$
\begin{aligned}
u' &= 2u+v\\
v' &= 2v+u\\
w' &= w
\end{aligned}
$$
Assuming $u'$, $v'$ and $w'$ are known, we can solve the system for $u$, $v$ and $w$ and obtain
$$
\begin{aligned}
u &= \frac{1}{3} \left(2u'-v'\right)\\
v &= \frac{1}{3} \left(2v'-u'\right)\\
t &= -\left(u+v\right)\\
w &= w'
\end{aligned}
$$
as desired.