How do you calculate the probability of the union of two events?

The probability of the union of two events is calculated by adding the probabilities of both events, then subtracting the probability of their intersection. This is because the probability of the union of two events is equal to the sum of their probabilities minus the probability of their intersection.

@import url(‘https://fonts.googleapis.com/css?family=Droid+Serif|Raleway’);

.axis–y .domain {
display: none;
}

h1 {
text-align: center;
font-size: 50px;
margin-bottom: 0px;
font-family: ‘Raleway’, serif;
}

p {
color: black;
text-align: center;
margin-bottom: 15px;
margin-top: 15px;
font-family: ‘Raleway’, sans-serif;
}

#words {
color: black;
font-family: Raleway;
max-width: 550px;
margin: 25px auto;
line-height: 1.75;
padding-left: 100px;
}

#calcTitle {
text-align: center;
font-size: 20px;
margin-bottom: 0px;
font-family: ‘Raleway’, serif;
}

#hr_top {
width: 30%;
margin-bottom: 0px;
border: none;
height: 2px;
color: black;
background-color: black;
}

#hr_bottom {
width: 30%;
margin-top: 15px;
border: none;
height: 2px;
color: black;
background-color: black;
}

#words label, input {
display: inline-block;
vertical-align: baseline;
width: 350px;
}

#button {
border: 1px solid;
border-radius: 10px;
margin-top: 20px;
padding: 10px 10px;
cursor: pointer;
outline: none;
background-color: white;
color: black;
font-family: ‘Work Sans’, sans-serif;
border: 1px solid grey;
/* Green */
}

#button:hover {
background-color: #f6f6f6;
border: 1px solid black;
}

Probability that event A does not occur: P(A’): 0.7

Probability that event B does not occur: P(B’): 0.5

Probability that event A and/or event B occurs P(A∪B): 0.65

Probability that event A and event B both occur P(A∩B): 0.15

Probability that either event A or event B occurs, but not both: 0.5

function probCalc() {

//get input values
var probA = document.getElementById(‘probA’).value;
var probB = document.getElementById(‘probB’).value;

//assign probabilities to variable names
var complementA = 1 – probA;
var complementB = 1 – probB;
var intersection = probA * probB;
var union = probA – (-1*probB) – intersection;
var singleOccur = probA – (-1*probB) – (2*intersection);

//output probabilities
document.getElementById(‘complementA’).innerHTML = complementA.toPrecision();
document.getElementById(‘complementB’).innerHTML = complementB.toPrecision();
document.getElementById(‘union’).innerHTML = union.toPrecision();
document.getElementById(‘intersection’).innerHTML = intersection.toPrecision();
document.getElementById(‘singleOccur’).innerHTML = singleOccur.toPrecision();
}

x