Adapt variation of variables respectively to their sum Excuse me for the weird title. 
I'm trying to control a character with a joystick. The joystick gives me two normalized values for the two respective axis. I'm using those values to determine the velocity needed to move my character (in each axis).
When I move sideways or forwards, I get $(1, 0)$ or $(0, 1)$. My problem is when I move digonally, the values I get are i.e. $(1, 1)$ which makes the character move faster.
I looked for a way to normalize those values accordingly to their sum, as it should never be greater than $1$, but I couldn't find anything.
It should leave the first 2 examples unchanged and change the last one to $(0.5, 0.5)$.
Thank you

So the length of a $2d$ vector $(x,y)$ is $\sqrt{x^2+y^2}$. 
For your velocity vectors $v=(v_x,v_y)$ it's speed is $\|v\|=\sqrt{v_x^2+v_y^2}$.
Notice for the vector $v_1=(1,0)$ (sideways) the speed is $1$, and similarly for the vector $v_2=(0,1)$ (forwards), you also find the speed is $1$.
Given that $v=(v_x,v_y)$


*

*If you want the same speed in all directions do: $$\frac{1}{\sqrt{v_x^2+v_y^2}}(v_x,v_y)$$

*If you want to weight it by the sum the easiest thing to do would be $$\frac{1}{v_x+v_y}(v_x,v_y)$$ but there will be a problem when $v_x=-v_y$ (another diagonal)

*As a remedy you could take $$\frac{1}{|v_x|+|v_y|}(v_x,v_y)$$
In this case there will be four diagonals all with the same speed. You would have to make sure though that this isn't implemented when $v_x=v_y=0$.


This last one should always give a speed less than one. You can use the triangle inequality. The speed of $v$ is $\|v\|$, and $v=v_x e_1+v_ye_2$, so $$\|v\|=\|v_xe_1+v_2e_2\|\leq |v_x|\|e_1\|+|v_y|\|e_2\|=|v_x|+|v_y|$$
So for the last option the new speed is $$\frac{\sqrt{v_x^2+v_y^2}}{|v_x|+|v_y|}\leq 1$$
If you want to see how this works in the last case:
$$(1,0)\to \frac{1}{1+0}(1,0)=(1,0)\quad \text{speed }= 1$$
$$(0,1)\to \frac{1}{0+1}(0,1)=(0,1)\quad \text{speed }= 1$$
$$(1,1)\to \frac{1}{1+1}(1,1)=\frac{1}{2}(1,1)=(0.5,0.5)\quad \text{speed }= \frac{\sqrt{2}}{2}=\frac{1}{\sqrt{2}}\sim0.7$$
