{
  "id": "combine-like-terms",
  "version": "cbd9abf31fc3",
  "status": "published",
  "name": "Combine Like Terms Calculator",
  "question": "How do I combine like terms?",
  "summary": "Simplifies an expression by multiplying out brackets and combining like terms, with exact fractions.",
  "category": "math",
  "subcategory": "algebra",
  "url": "https://www.acalculator.org/math/combine-like-terms-calculator",
  "markdown": "https://www.acalculator.org/math/combine-like-terms-calculator.md",
  "kind": "function",
  "method": "Multiply out brackets and whole powers, then add the exact coefficients of terms with the same letters to the same powers.",
  "assumptions": [
    "Coefficients are exact fractions: 0.1 is 1/10. Pieces such as sin(x) are combined only when written the same way."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "e": {
        "title": "Expression",
        "description": "An expression in one or more letters.",
        "type": "string",
        "maxLength": 200
      }
    }
  },
  "outputs": {
    "result": {
      "label": "Simplified",
      "description": "The expression with like terms combined.",
      "format": "math"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "e": "3x + 7 + 4x + 5"
    },
    "outputs": {
      "result": "7x + 12"
    },
    "text": "3x + 7 + 4x + 5 simplifies to 7x + 12."
  },
  "examples": [
    {
      "given": {
        "e": "3x + 7 + 4x + 5"
      },
      "expect": {
        "result": "7x + 12"
      },
      "source": "OpenStax Prealgebra 2e, 2.2, Ex. 2.21. https://openstax.org/books/prealgebra-2e/pages/2-2-evaluate-simplify-and-translate-expressions"
    },
    {
      "given": {
        "e": "7x^2 + 8x - x^2 - 4x"
      },
      "expect": {
        "result": "6x^2 + 4x"
      },
      "source": "OpenStax Prealgebra 2e, 2.2, Ex. 2.22"
    }
  ],
  "sources": [
    "OpenStax, Prealgebra 2e, section 2.2 Evaluate, Simplify, and Translate Expressions: https://openstax.org/books/prealgebra-2e/pages/2-2-evaluate-simplify-and-translate-expressions"
  ],
  "related": [
    "simplify",
    "polynomial",
    "factoring",
    "order-of-operations"
  ],
  "changelog": []
}
