Brain Dump

Venn Diagram

Tags
math

Is a way to represent the frequency or probabilities of data/events and how they coincide with each other.

\begin{figure}
  \centering
  \begin{tikzpicture}[fill=gray]
    % left hand
    (1,0) circle (1);
    \fill (0,0) circle (1);
    \node at (-0.5, 0) {$A$};

    % right hand
    (0,0) circle (1);
    \fill (1,0) circle (1);
    \node at (1.5, 0) {$B$};

    % center
    \node at (0.5, 0) {$C$};

    % outline
    \draw (0,0) circle (1)
    (1,0) circle (1);

    % box
    \draw[thick] (-1.75,-1.75) rectangle (2.75,1.75);
    \node at (-1.5, -1.5) {$D$};
  \end{tikzpicture}
  \caption{A venn diagram showing the number of objects with two properties \( A \)
  and \( B \). The region at the intersection of the two circles, \( C \), refers to
  the number of objects having both property \( A \) and \( B \) at the same time.
  The value \( D \) represents the number of objects with neither property \( A \)
  nor property \( B \).}
\end{figure}

Creating a Venn Diagram example

When presented with a Venn diagram problem, you'll often receive a total count of elements, and then the numbers of elements having one or more properties. In these situations you should start with the most specific relation (example: the number of elements having all the properties) and then derive the numbers for less specific properties as the difference between more specific variants.

For example

A sample of 1000 products were inspected, following which these results were found:

  • 31 had a type A defect
  • 37 had a type B defect
  • 42 had a type C defect
  • 11 had both type A and type B defects
  • 13 had both type B and type C defects
  • 10 had both type A and type C defects
  • 6 had all three types of defects

Plot this data on a venn diagram.

You can see the results in fig:venn-eg. Beginning with the center point of 6 we can deduce the total number of products having both A and B defects is \( 11 - 6 = 5 \). The number having both A and C must be \( 10 - 6 = 4 \). Meaning the total having just the type A defect is \( 31 - 5 - 6 - 4 = 16 \). This same approach can be repeated to find the rest of venn diagram. After which we can sum the results in the diagram and subtract from the total to get \( 1000 - 82 = 918 \).

\begin{figure}
  \centering
  \label{fig:venn-eg}
  \begin{tikzpicture}[fill=gray]
    % left hand
    (1,0) circle (1);
    \fill (0,0) circle (1);
    \node at (-1.25, 0.5) {$A$};

    % right hand
    (0,0) circle (1);
    \fill (1,0) circle (1);
    \node at (2.25, 0.5) {$B$};

    % bottom
    (0.5,-1) circle (1);
    \fill (0.5,-1) circle (1);
    %\node at (1.5, 0) {$C$};
    \node at (0.5, -2.25) {$C$};

    % center
    \draw (0,0) circle (1)
    (1,0) circle (1)
    (0.5,-1) circle (1);

    % box
    \draw[thick] (-2.5,-2.5) rectangle (3.25,1.50);
    \node at (-2, -2.25) {$918$};

    % numbers
    \node at (-0.5, 0.25) {$16$};
    \node at (0.5, 0.25) {$5$};
    \node at (1.5, 0.25) {$19$};
    \node at (0.5, -0.35) {$6$};
    \node at (-0.15, -0.65) {$4$};
    \node at (1.1, -0.65) {$7$};
    \node at (0.5, -1.25) {$25$};
  \end{tikzpicture}
  \caption{Solution to the venn diagram problem described in \autoref{create-example}.}
\end{figure}

The advantage of a venn diagram is that it makes identifying the distribution of the data simple. For example what is the probability of a random product having at least 2 defects? It is \( \frac{5 + 6 + 4 + 7}{1000} = \frac{22}{1000} = 2.2\% \).

Links to this note