So I have been looking at this question: How to convert an English sentence that contains "Exactly two" or "Atleast two" into predicate calculus sentence? And the way I would do this didn't really show up there.
So I would like to write "Exactly two..." like this:
Let $P(x)$ be a predicate, so to say exactly two terms satisfy $P$ I would write: $$\exists x \exists!y((x \ne y) \wedge P(x) \wedge P(y))$$
Now, this would ensure that $x \ne y $ and since $=$ is an equivalence relation, it ensures that there is only one such $x$ and $y$.
Would this be a right way to write it? I'm not a mathematican, so I was unsure If I can provide this as an answer, but it got me curious as my notation is much shorter than the ones proposed in the linked question.
Your expression translates to something like:
This is equivalent to saying that there are exactly two elements making $P$ true, so is correct.
You can generalise your characterisation to define quantifiers $\exists^n$ for $n \ge 1$ meaning 'there exist exactly $n$' in the following way:
Note that the recursive definition of $\exists^2$ collapses to precisely the definition you made.