This is probably because by default `Sort`

doesn't just use numerical values, it includes structure information as well. From the doc:

Numeric expressions are sorted by structure as well as numerical value:

```
In[1]:= Sort[{Sqrt[2], 1, 2, 1/Sqrt[2]}]
Out[1]= {1, 2, 1/Sqrt[2], Sqrt[2]}
```

Sort by numerical value only:

```
In[2]:= Sort[{Sqrt[2], 1, 2, 1/Sqrt[2]}, Less]
Out[2]= {1/Sqrt[2], 1, Sqrt[2], 2}
```

along with the following doc:

Sort usually orders expressions by putting shorter ones first, and then comparing parts in a depth-first manner.

gives us a hint why. If you run `TreeForm /@ {0, 20 Sqrt[5], 40 Sqrt[5], 20 Sqrt[5], 20 Sqrt[10]}`

, you'll see that the last layer (`Rational`

) is the same for all four `Sqrt`

s. Then the next depth down is the `Power`

, in which `10`

is the outlier, and is greater than `5`

, so will be placed last. Finally, comparing `{20, 40, 20}`

will give the ordering `{1, 3, 2}`

, which when put together with the original list gives you the ordering:

```
In[77]:= Ordering[{0, 20 Sqrt[5], 40 Sqrt[5], 20 Sqrt[5], 20 Sqrt[10]}]
Out[77]= {1, 2, 4, 3, 5}
```

2

For a similarly confusing problem with the same origin, look here

– Leonid Shifrin – 2012-03-08T16:38:27.383