# Calculating Powersets

**URL:** <https://community.wolfram.com/t/calculating-powersets/6077>\
**Category:** Questions\
**Tags:** mathematica, wolfram-alpha, calculus\
**Created:** [July 2, 2015, 9:09am UTC](https://community.wolfram.com/t/calculating-powersets/6077 "2015-07-02T09:09:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dolbik](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dolbik](https://community.wolfram.com/u/dolbik)\
**Post date:** [July 2, 2015, 9:09am UTC](https://community.wolfram.com/t/calculating-powersets/6077/1 "2015-07-02T09:09:17Z")

</div>

I have to sets `A={1,2,3}` and `B={a,b,c,d,e}`. I want the set of subsets of elements from both A and B that contain at least one element of A and one element of B. I wanted to calculate it using the following formula:

```
P(A?B)?(P(A)?P(B))

```

I tried the following query:

```
Subsets[{1,2,3} union {a,b,c,d,e}]/(Subsets[{1,2,3}] union Subsets[{a,b,c,d,e}])

```

But, unfortunately, Wolframalpha doesn’t understand my query.

Is there any other way?

---

<div class="post-metadata">

**Author:** ![gathercoledt](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/gathercoledt/32/34139_2.png) [@gathercoledt](https://community.wolfram.com/u/gathercoledt)\
**Post date:** [July 2, 2015, 3:27pm UTC](https://community.wolfram.com/t/calculating-powersets/6077/2 "2015-07-02T15:27:38Z")

</div>

Try explicitly using the named Wolfram language functions Union and Complement with square brackets.

In Mathematica the following works (dropping the empty set):

```
Complement[Subsets[{1, 2, 3, a, b, c, d, e}], {#} & /@ {1, 2, 3, a, b, c, d, e}]

```
