6
$\begingroup$

I have 5 lists collected over 5 years as follows.

year1 = [8, 1, 5, 6]
year2 = [6, 8]
year3 = [8, 5, 6]
year4 = [9, 2, 8, 1, 6]
year5 = [8, 1, 6]

I extracted the elements that are common to all the 5 lists as; [8, 6]

I want to denote the above process using a mathematical notation. i.e. my output is the elements that are commeon to all the years.

However, due to my lack of knowledge in notations I am not sure how to do it, in a more compact way.

I am happy to provide more details if needed.

$\endgroup$
9
$\begingroup$

If it's reasonable to treat them as sets (e.g. each distinct element can only ever appear once, order doesn't matter, etc), then you can use set-intersection to denote the elements in common:

$A_1 = \{8,1,5,6\}$

$A_2 = \{6,8\}$

... etc

Then $A_1\cap A_2\cap A_3\cap A_4\cap A_5 = \{6,8\}$

If you have a large number of sets to take the intersection of, you could write $A_1\cap A_2\cap \ldots \cap A_n$ as

$$\bigcap_{i=1}^n A_i$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.