Adding Fractions Calculator

Adding Fractions Calculator

+

Result:


How to Add Fractions: A Step-by-Step Guide

Adding fractions is a fundamental skill in mathematics. Whether you are dealing with like denominators (the bottom numbers are the same) or unlike denominators, the process follows a logical sequence of steps.

1. Find a Common Denominator

If the denominators are different, you must find a common multiple. The easiest way is to multiply the two denominators together. For example, to add 1/3 and 2/5, the common denominator is 3 × 5 = 15.

2. Adjust the Numerators

Once you have a common denominator, you must adjust the numerators (the top numbers) to keep the fractions equivalent:

  • Multiply the first numerator by the second denominator.
  • Multiply the second numerator by the first denominator.

3. Add the Numerators

Keep the common denominator as it is and add the adjusted numerators together. This provides your raw result.

4. Simplify the Fraction

Always check if the resulting fraction can be simplified. This is done by finding the Greatest Common Divisor (GCD) of the numerator and the denominator and dividing both by that number.

Example Calculation

Let's add 1/4 and 2/3:

  1. Common Denominator: 4 × 3 = 12.
  2. Adjust Numerators: (1 × 3) = 3 and (2 × 4) = 8.
  3. Sum: (3 + 8) / 12 = 11/12.
  4. Result: 11/12 (This fraction is already in its simplest form).
function calculateFractions() { var n1 = parseInt(document.getElementById('num1').value); var d1 = parseInt(document.getElementById('den1').value); var n2 = parseInt(document.getElementById('num2').value); var d2 = parseInt(document.getElementById('den2').value); var resultDiv = document.getElementById('fractionResult'); var finalFraction = document.getElementById('finalFraction'); var decimalResult = document.getElementById('decimalResult'); var stepDisplay = document.getElementById('stepDisplay'); if (isNaN(n1) || isNaN(d1) || isNaN(n2) || isNaN(d2)) { alert("Please enter valid numbers in all fields."); return; } if (d1 === 0 || d2 === 0) { alert("Denominator cannot be zero."); return; } // Logic for adding fractions: (n1*d2 + n2*d1) / (d1*d2) var commonDenominator = d1 * d2; var adjustedNum1 = n1 * d2; var adjustedNum2 = n2 * d1; var resultNumerator = adjustedNum1 + adjustedNum2; // Simplify the fraction var gcd = function(a, b) { return b ? gcd(b, a % b) : a; }; var commonDivisor = Math.abs(gcd(resultNumerator, commonDenominator)); var simplifiedNumerator = resultNumerator / commonDivisor; var simplifiedDenominator = commonDenominator / commonDivisor; // Display Logic resultDiv.style.display = 'block'; stepDisplay.innerHTML = "Steps: (" + n1 + " × " + d2 + ") + (" + n2 + " × " + d1 + ") / (" + d1 + " × " + d2 + ")"; if (simplifiedDenominator === 1) { finalFraction.innerHTML = simplifiedNumerator; } else { finalFraction.innerHTML = simplifiedNumerator + " / " + simplifiedDenominator; } var decimalValue = (simplifiedNumerator / simplifiedDenominator).toFixed(4); decimalResult.innerHTML = "Decimal Value: " + decimalValue; } function clearFractions() { document.getElementById('num1').value = "; document.getElementById('den1').value = "; document.getElementById('num2').value = "; document.getElementById('den2').value = "; document.getElementById('fractionResult').style.display = 'none'; }

Leave a Comment