Under exactly the conditions that you have in the question.
Whose is used as a relative pronoun, to introduce a clause that describes something belonging to the noun phrase it follows.
Now, there are some people do object to the adjective senses of whose being used of inanimate antecedents, based on the mistaken belief that it comes solely from who, when it comes from whos which comes from hwæs which was the genitive of both hwa (who) and hwæt(what). The objection flies in the face of much eloquent usage, and is also rarer now.
Each is a determiner, it refers to all of the examples of the thing that will be named, so that what is stated of them singularly applies to every one of them.
We have "each pair is". Generally, those things covered by each are treated as singular, unless each follows a plural subject, in which case they are treated as plural, with a further exception allowing (some would say not, while some would say insisting, it's here we enter into a matter of debate) if the plural subject is the pronoun we.
Here we do not have each following a plural subject, so the singular should be used, and so it is. Again, we're fine.
Putting them together we have a noun phrase "The set of elements" followed by a relative pronoun, followed by a determiner which insists upon singular use of what follows, followed by a singular use.
It is perfectly grammatical. Looking for objections to different uses of the words involved, we find that not only are there none, there aren't even questionable objections to argue against.
Now, it is relatively rare. It's common here to use where instead of whose, which ironically is a use that does frequently find objectors saying where can only refer to place, literally or figurative.
It's common to use every or all. However each conveys a sense of precision; it's merely a side-effect of every being treated plural and each being treated singularly leading to a sense that we are focusing on each item rather than making a more sweeping statement, and there's no real lack of precision with every, but that impression is worth making in technical cases like mathematics.
And for that reason, it is relatively common in such contexts.
About the only possible objection I can see to this as a whole, is that the form "[Noun]1 of [Noun]2s whose each [Noun]3 is..." could be ambiguous as to whether it is [Noun]1 or its [Noun]2s that possesses the [Noun]3s that are being described.
- It would generally be clear from context; ambiguous forms are only a problem if they result in ambiguous reading, otherwise we can object to just about every bare expression as leaving out some information and hence being ambiguous.
- It would lean heavily toward our interpreting it as saying that it is the [Noun]2s that have the [Noun]3s (in the example, the elements that have the pairs). Only if that reading was both incorrect, and it being incorrect was not clear from context, do we have a problem.
- In this case we have the form "The set of [Noun]2s whose [Noun]3s..." since it's extremely common to define sets in terms of the properties of its elements, we're led very strongly to the understanding that it is elements that have pairs. All the more so since the word used for the elements is element (now if that was element in another sense, that would be ambiguous, but in a totally different way).
- Unless we have another context to explain some special meaning of set, then the reading of the set having the pairs makes no meaning, and so will be instantly dismissed, leaving us with no ambiguity.
So that possible objection clearly doesn't apply here. It's also not a question of grammaticality.
In all, the form is not just grammatical, and reasonably common in the domain it is used in, but a good choice.
[Taking a look at the question on ELL, it seems that the problem was that it wasn't ambiguous enough, as what they meant was "set whose each pair of elements", which is neither of the readings I suggest are possible with the form, but that's a separate issue].