Which of the following is true about Manhattan distance?

it can be used for continuous variables
it can be used for categorical variables
it can be used for categorical as well as continuous
it can be used for constants

The correct answer is: C. it can be used for categorical as well as continuous.

Manhattan distance is a measure of distance between two points in a multidimensional space. It is also known as the city-block distance or L1 distance. It is calculated by summing the absolute differences between the coordinates of the two points.

Manhattan distance can be used for both continuous and categorical variables. For continuous variables, the coordinates of the points are the values of the variables. For categorical variables, the coordinates of the points are the codes of the categories.

For example, let’s say we have two points in a two-dimensional space, with coordinates (1, 2) and (3, 4). The Manhattan distance between these two points is 5, which is calculated as follows:

$|1 – 3| + |2 – 4| = 2 + 2 = 4$

Now, let’s say we have two points in a two-dimensional space, with coordinates (red, green) and (blue, yellow). The Manhattan distance between these two points is 3, which is calculated as follows:

$|red – blue| + |green – yellow| = 1 + 2 = 3$

As you can see, Manhattan distance can be used for both continuous and categorical variables.