# How do I normalize a vector of numbers so they are between 0 and 1? [duplicate]

I have a vector of numbers (both positive and negative). How can I normalize it so the values of the normalized vector will be between 0 and 1?

## 1 Answer

This is called unity-based normalization. If you have a vector $X$, you can obtain a normalized version of it, say $Z$, by doing:

$$Z = \frac{X - \min(X)}{\max(X) - \min(X)}$$