I have to formalize the sentence:
"Earth is the only planet inhabited by mathematicians"
Let:
- $P(x)$ stands for 'x is a planet'
- $M(x)$ stands for 'x is a mathematician'
- $I(x,y)$ stands for 'x inhabits the planet y'
- $e$ stands for 'Earth' (a constant)
Is the following formalisation correct?
$P(e)\wedge\forall x\;((M(x)\wedge\exists y\: (P(y)\wedge I(x,y)))\rightarrow I(x,e))$
I interpreted the sentence in this way:
Earth is a planet and every mathematician that inhabits a planet necessarily inhabits the planet Earth.
Your statement says that Earth is a planet and, if there is a mathematician that inhabits some planet, then said mathematician inhabits Earth.
This is very nearly what you need to say, but it doesn't quite get there on its own. After all, it doesn't rule out the possibility that one may inhabit multiple planets.
Instead, we should say that if there is a planet inhabited by mathematicians, then said planet is Earth. So, we would instead have $$\forall y\Bigl(\Bigl(\exists x\bigl(M(x)\wedge I(x,y)\bigr)\Bigr)\longrightarrow y=e\Bigl).$$
Note that this does not assert that Earth is a planet, nor that there are any mathematicians anywhere at all. Rather, it asserts (from a set-theoretic standpoint) that, if there is an element in the set of planets inhabited by at least one mathematician, then that element is Earth. Put more simply, $y$ is a planet inhabited by mathematicians only if $y$ is Earth.
There is some unfortunate ambiguity in the English language, so it may be that the speaker intended to say that Earth is a planet inhabited by mathematicians, and is the only such planet. However, that isn't really clear from their phrasing.