Cardinality of Unions of Powersets

  • #1
Xavier Labouze
12
1
TL;DR Summary
Given A, a set (note P(A) its powerset) and A1, A2... Ak, k subsets of A. What is the cardinality of P(A1)∪P(A2)∪...∪P(Ak) ?
Mentor note: In this thread I (Mark44) have edited "cardinal" to "cardinality." In English, we talk about the "cardinality of a set," not the "cardinal of the set."
Given A a set of n elements - note |A| its cardinal and P(A) its powerset. Let A1, A2... Ak, be k subsets (not empty) of A.

What is the cardinality of P(A1)∪P(A2)∪...∪P(Ak) ? - Is there a formula or a rapid algorithm to compute it ? (I don't see how to compute it in polynomial time when the subsets are not pairwise disjoint...)

Thank you.
 
Last edited by a moderator:

Answers and Replies

  • #2
jambaugh
Science Advisor
Insights Author
Gold Member
2,335
313
Hmmm...
The pertinent question here is, I believe, "What is the intersection of the power sets of two sets in terms of their intersection?"

Next, consider how to make the problem recursive. Relate the first set to the problem applied to the remaining sets.

BTW Is this a homework or assignment?
 
  • #3
Xavier Labouze
12
1
Tks. No it is not a homework. I really wonder if it exists an algorithm running in polynomial time in ##n## (the cardinality of ##A##) - About your comment : ##P(A) \cap P(B) = P(A \cap B)## but ##\overline{P(A)} \ne P(\overline{A})## so how to deal with it?
 
Last edited by a moderator:
  • #4
Office_Shredder
Staff Emeritus
Science Advisor
Gold Member
5,517
1,468
If you just start with two:
##P(A_1) \cup P(A_2)##.

You know the cardinality of ##P(A_1)##. What elements of ##P(A_2)## are not contained in ##P(A_1)##, and how many are there?
 
  • #5
Xavier Labouze
12
1
Right, ##|P(A_1) \cup P(A_2)|=|P(A_1)|+|P(A_2)|-|P(A_1 \cap A_2)|## but I don't see how to continue...
 
  • #6
Office_Shredder
Staff Emeritus
Science Advisor
Gold Member
5,517
1,468
Now suppose you have three. If ##B\in P(A_1)\cup P(A_2)\cup P(A_3)##. Then B is a subset of one of the ##A_i##s, which gives us ##|P(A_1)|+|P(A_2)|+|P(A_3)|##. But if B is a subset of any pair of them we overcounted it, so we have to subtract ##|P(A_1\cap A_2)| + |P(A_1\cap A_3)| + |P(A_2 \cap A_3)|##. But if it was a subset of all three of them, we added it three times and subtracted it three times, so we need to add back in ##|P(A_1 \cap A_2 \cap A_3)|##.

Are you starting to see a pattern?
 
  • #7
Xavier Labouze
12
1
I must have written the question wrong. I am a teacher not a student and I wonder if counting the cardinality of unions of powersets can be computed in polynomial time (or is it #NP-Complete ?). If you have the answer please give it to me.
I should certainly change the question in this way...
Thanks anyway for your concern.
 
Last edited by a moderator:
  • #8
Xavier Labouze
12
1
It seems I can't change the question any more...
 
  • #9
pbuk
Science Advisor
Homework Helper
Gold Member
4,084
2,411
I wonder if counting the cardinality of unions of powersets can be computed in polynomial time...

Right, ##|P(A_1) \cup P(A_2)|=|P(A_1)|+|P(A_2)|-|P(A_1 \cap A_2)|##
So for 2 subsets you had to calculate 3 cardinalities.
Now suppose you have three. If ##B\in P(A_1)\cup P(A_2)\cup P(A_3)##. Then B is a subset of one of the ##A_i##s, which gives us ##|P(A_1)|+|P(A_2)|+|P(A_3)|##. But if B is a subset of any pair of them we overcounted it, so we have to subtract ##|P(A_1\cap A_2)| + |P(A_1\cap A_3)| + |P(A_2 \cap A_3)|##. But if it was a subset of all three of them, we added it three times and subtracted it three times, so we need to add back in ##|P(A_1 \cap A_2 \cap A_3)|##.
For 3 subsets, 7 cardinalities.
Are you starting to see a pattern?
 
Last edited by a moderator:
  • #10
Xavier Labouze
12
1
The question is : is it the best (the fatest) way to compute theses unions ? How to prove it ?
 
  • #11
Office_Shredder
Staff Emeritus
Science Advisor
Gold Member
5,517
1,468
Well, to give a maybe useless extension to your original claim that you can only do it if they are pairwise disjoint - if they are l-wise disjoint for any fixed l, this gives you a polynomial time algorithm for computing the cardinality.

I think the problem at the start was you asked if there was a formula or a rapid algorithm, and I thought well yes, there is a very simple formula. It wasn't clear to me that you already knew about it, sorry.

When you say you want a polynomial time algorithm, in what parts exactly? For example if the size of A is fixed, you can just ignore all the trickiness and write down all the unique elements of the power sets.
 
  • #12
Xavier Labouze
12
1
Well, to give a maybe useless extension to your original claim that you can only do it if they are pairwise disjoint - if they are l-wise disjoint for any fixed l, this gives you a polynomial time algorithm for computing the cardinality.

I think the problem at the start was you asked if there was a formula or a rapid algorithm, and I thought well yes, there is a very simple formula. It wasn't clear to me that you already knew about it, sorry.
Thank you, my question was written wrong - my first question on this forum, my bad.
 
  • #13
Office_Shredder
Staff Emeritus
Science Advisor
Gold Member
5,517
1,468
I edited this into my post above but you replied during it so posting it again:


When you say you want a polynomial time algorithm, in what parts exactly? For example if the size of A is fixed, you can just ignore all the trickiness and write down all the unique elements of the power sets.
 
  • #14
Xavier Labouze
12
1
I edited this into my post above but you replied during it so posting it again:


When you say you want a polynomial time algorithm, in what parts exactly? For example if the size of A is fixed, you can just ignore all the trickiness and write down all the unique elements of the power sets.
A polytime algorithm in ##n=|A|##
(Nice quote BTW)
 
  • #15
Office_Shredder
Staff Emeritus
Science Advisor
Gold Member
5,517
1,468
In that case just using the formula works. I assume you want it to be polynomial in k as well?
 
  • #16
Xavier Labouze
12
1
In that case just using the formula works. I assume you want it to be polynomial in k as well?
No - With ##k## bounded by a polynom in ##n##
 
Last edited:
  • #17
jambaugh
Science Advisor
Insights Author
Gold Member
2,335
313
Here's my algorithm.
Define Function:
Take ##A_1## and partition it into ##C_1 = \bigcup_{k=2}^n A_1\cap A_k##, and ##D_1 = A_1 - C_1##.
Return ##2^{|D_1|}##+Function applied to remainder of the list.

How does that look? If the sets are of size on the order of M then the intersection of a pair should take ##O(M^2)##?
So the whole process should take ##O(M^2 n^2)## steps. (That is if my algorithm is correct.)
 
  • Like
Likes Xavier Labouze
  • #18
Xavier Labouze
12
1
Here's my algorithm.
Define Function:
Take ##A_1## and partition it into ##C_1 = \bigcup_{k=2}^n A_1\cap A_k##, and ##D_1 = A_1 - C_1##.
Return ##2^{|D_1|}##+Function applied to remainder of the list.

How does that look? If the sets are of size on the order of M then the intersection of a pair should take ##O(M^2)##?
So the whole process should take ##O(M^2 n^2)## steps. (That is if my algorithm is correct.)
It looks good - but it doesn't work (see the comment below...) .
 
Last edited:
  • #19
Office_Shredder
Staff Emeritus
Science Advisor
Gold Member
5,517
1,468
If you have a in ##A_1## only, and b in ##A_1## and ##A_2##, does the set {a,b} ever get counted by the algorithm? I missed not understand it because it seems like it doesn't.
 
  • #20
Xavier Labouze
12
1
@Office_Shredder is right. The algorithm does not work, it misses a lot of subsets of ##A_1##. An idea may be is to count all subsets only included in ##P(A_1)## , i.e. ##P(C_1) X [P(D_1)- \emptyset]## (they are ##2^{|A_1|}-2^{|C_1|}##) and to continue... that is to say, replace ##2^{|D_1|}## in the algorithm by ##2^{|A_1|}-2^{|C_1|}##... What do you think ?
 
Last edited:
  • #21
Xavier Labouze
12
1
No it doesn't work either : by removing all ##2^{|C_1|}## subsets of ##A_1##, it is as if all the ##C_1## elements form a proper subset in another subset than ##A_1## which is not sure...
 
  • #22
jambaugh
Science Advisor
Insights Author
Gold Member
2,335
313
Oops! You (y'all) are correct. Hmmm... If instead, I take ##2^{|A_1|}-2^{|D_1|}## ... no that won't work either. That would exclude sets such as ##\{a,b\}\subseteq D_1## but where ##a## and ##b## do not both appear in any of the subsequent sets. Dang... let me think on it further.
 

Suggested for: Cardinality of Unions of Powersets

Replies
5
Views
591
Replies
19
Views
1K
Replies
9
Views
725
  • Last Post
Replies
1
Views
355
  • Last Post
Replies
7
Views
820
  • Last Post
Replies
8
Views
588
Replies
7
Views
754
  • Last Post
Replies
4
Views
2K
Top