{
  "id": "phase-shift",
  "version": "5dda22ce571e",
  "status": "published",
  "name": "Phase Shift Calculator",
  "question": "What is the phase shift?",
  "summary": "Phase shift calculator for y = A sin(Bx − C) + D or A cos(Bx − C) + D: the phase shift C/B and its direction, the amplitude, period, frequency, vertical shift, maximum and minimum, with π typed exactly.",
  "category": "math",
  "subcategory": "trigonometry",
  "url": "https://www.acalculator.org/math/phase-shift-calculator",
  "markdown": "https://www.acalculator.org/math/phase-shift-calculator.md",
  "kind": "function",
  "method": "y = A sin(Bx − C) + D or A cos(Bx − C) + D: amplitude |A|, period 2π ÷ |B|, phase shift C ÷ B (right when positive, left when negative), vertical shift D, maximum D + |A|, minimum D − |A|.",
  "assumptions": [
    "The function is written as A sin(Bx − C) + D or A cos(Bx − C) + D, with B not 0 and A not 0. For Bx + C, type −C.",
    "x is in radians, so π in B or C is exact; the phase shift and period are in the same units as x."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "fn": {
        "title": "Function",
        "description": "Sine or cosine: y = A sin(Bx − C) + D or y = A cos(Bx − C) + D.",
        "type": "string",
        "enum": [
          "sin",
          "cos"
        ]
      },
      "a": {
        "title": "A",
        "description": "The number in front of sin or cos; its size is the amplitude.",
        "type": "string",
        "pattern": "^-?\\d+( \\d+)?(/\\d+)?$"
      },
      "b": {
        "title": "B",
        "description": "The number that multiplies x; it sets the period. Type π as π or pi.",
        "type": "string",
        "maxLength": 30
      },
      "c": {
        "title": "C",
        "description": "The number subtracted from Bx. For sin(2x + π/3), C is −π/3.",
        "type": "string",
        "maxLength": 30
      },
      "d": {
        "title": "D",
        "description": "The number added at the end; it moves the graph up or down.",
        "type": "string",
        "pattern": "^-?\\d+( \\d+)?(/\\d+)?$"
      }
    }
  },
  "outputs": {
    "shift": {
      "label": "Phase shift",
      "description": "C ÷ B, exactly, with its direction: right when positive, left when negative.",
      "format": "text"
    },
    "shiftValue": {
      "label": "Phase shift (decimal)",
      "description": "C ÷ B as a decimal; positive moves the graph right.",
      "format": "number"
    },
    "amplitude": {
      "label": "Amplitude",
      "description": "|A|: the height of a crest above the midline.",
      "format": "number"
    },
    "period": {
      "label": "Period",
      "description": "2π ÷ |B|, exactly.",
      "format": "text"
    },
    "periodValue": {
      "label": "Period (decimal)",
      "description": "2π ÷ |B| as a decimal: the length of one full cycle.",
      "format": "number"
    },
    "frequency": {
      "label": "Frequency",
      "description": "|B| ÷ 2π: cycles per unit of x, 1 ÷ period.",
      "format": "number"
    },
    "verticalShift": {
      "label": "Vertical shift (midline)",
      "description": "D: the midline is y = D.",
      "format": "number"
    },
    "max": {
      "label": "Maximum",
      "description": "D + |A|.",
      "format": "number"
    },
    "min": {
      "label": "Minimum",
      "description": "D − |A|.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "fn": "sin",
      "a": "3",
      "b": "2",
      "c": "π/2",
      "d": "1"
    },
    "outputs": {
      "shift": "π/4 to the right",
      "shiftValue": 0.7853981633974483,
      "amplitude": 3,
      "period": "π",
      "periodValue": 3.141592653589793,
      "frequency": 0.3183098861837907,
      "verticalShift": 1,
      "max": 4,
      "min": -2
    },
    "text": "The phase shift is π/4 to the right, with amplitude 3, period π and vertical shift 1."
  },
  "examples": [
    {
      "given": {
        "fn": "sin",
        "a": "3",
        "b": "2",
        "c": "0",
        "d": "1"
      },
      "expect": {
        "amplitude": 3,
        "period": "π",
        "periodValue": 3.141592653589793,
        "shift": "0 (no horizontal shift)",
        "verticalShift": 1
      },
      "source": "OpenStax, Precalculus 2e, §6.1 Graphs of the Sine and Cosine Functions (y = A sin(Bx − C) + D: amplitude |A|, period 2π/|B|, phase shift C/B, vertical shift D), https://openstax.org/books/precalculus-2e/pages/6-1-graphs-of-the-sine-and-cosine-functions (retrieved 2026-10-18), Example 5: amplitude 3, period π, no phase shift, midline y = 1"
    },
    {
      "given": {
        "fn": "sin",
        "a": "3",
        "b": "π/4",
        "c": "π/4",
        "d": "0"
      },
      "expect": {
        "shift": "1 to the right",
        "shiftValue": 1,
        "period": "8",
        "periodValue": 8,
        "amplitude": 3,
        "max": 3,
        "min": -3
      },
      "source": "OpenStax, Precalculus 2e, §6.1 Graphs of the Sine and Cosine Functions (y = A sin(Bx − C) + D: amplitude |A|, period 2π/|B|, phase shift C/B, vertical shift D), https://openstax.org/books/precalculus-2e/pages/6-1-graphs-of-the-sine-and-cosine-functions (retrieved 2026-10-18), Example 9: amplitude 3, period 8, phase shift 1 unit to the right"
    },
    {
      "given": {
        "fn": "cos",
        "a": "-2",
        "b": "π/2",
        "c": "−π",
        "d": "3"
      },
      "expect": {
        "shift": "2 to the left",
        "shiftValue": -2,
        "period": "4",
        "amplitude": 2,
        "verticalShift": 3,
        "max": 5,
        "min": 1
      },
      "source": "OpenStax, Precalculus 2e, §6.1 Graphs of the Sine and Cosine Functions (y = A sin(Bx − C) + D: amplitude |A|, period 2π/|B|, phase shift C/B, vertical shift D), https://openstax.org/books/precalculus-2e/pages/6-1-graphs-of-the-sine-and-cosine-functions (retrieved 2026-10-18), Example 10: amplitude 2, period 4, phase shift −2 (2 units left), vertical shift 3"
    },
    {
      "given": {
        "fn": "sin",
        "a": "1",
        "b": "1",
        "c": "-π/6",
        "d": "-2"
      },
      "expect": {
        "shift": "π/6 to the left",
        "shiftValue": -0.5235987755982988,
        "period": "2π",
        "verticalShift": -2
      },
      "source": "OpenStax, Precalculus 2e, §6.1 Graphs of the Sine and Cosine Functions (y = A sin(Bx − C) + D: amplitude |A|, period 2π/|B|, phase shift C/B, vertical shift D), https://openstax.org/books/precalculus-2e/pages/6-1-graphs-of-the-sine-and-cosine-functions (retrieved 2026-10-18), Examples 3 and 4: phase shift π/6 to the left, shifted 2 units down"
    },
    {
      "given": {
        "fn": "sin",
        "a": "1",
        "b": "pi/6",
        "c": "0",
        "d": "0"
      },
      "expect": {
        "period": "12",
        "periodValue": 12,
        "frequency": 0.08333333333333333
      },
      "source": "OpenStax, Precalculus 2e, §6.1 Graphs of the Sine and Cosine Functions (y = A sin(Bx − C) + D: amplitude |A|, period 2π/|B|, phase shift C/B, vertical shift D), https://openstax.org/books/precalculus-2e/pages/6-1-graphs-of-the-sine-and-cosine-functions (retrieved 2026-10-18), Example 1: B = π/6, so the period is 2π ÷ (π/6) = 12"
    },
    {
      "given": {
        "fn": "cos",
        "a": "0.5",
        "b": "4",
        "c": "1",
        "d": "0"
      },
      "expect": {
        "shift": "1/4 to the right",
        "shiftValue": 0.25,
        "period": "π/2",
        "periodValue": 1.5707963267948966
      },
      "source": "hand calculation in content.mdx: phase shift 1 ÷ 4 = 1/4, period 2π ÷ 4 = π/2; OpenStax, Precalculus 2e, §6.1 Graphs of the Sine and Cosine Functions (y = A sin(Bx − C) + D: amplitude |A|, period 2π/|B|, phase shift C/B, vertical shift D), https://openstax.org/books/precalculus-2e/pages/6-1-graphs-of-the-sine-and-cosine-functions (retrieved 2026-10-18)"
    },
    {
      "given": {
        "fn": "sin",
        "a": "2",
        "b": "π",
        "c": "1",
        "d": "0"
      },
      "expect": {
        "shift": "1/π to the right",
        "shiftValue": 0.3183098861837907,
        "period": "2",
        "frequency": 0.5
      },
      "source": "hand calculation in content.mdx: phase shift 1 ÷ π = 1/π, period 2π ÷ π = 2; OpenStax, Precalculus 2e, §6.1 Graphs of the Sine and Cosine Functions (y = A sin(Bx − C) + D: amplitude |A|, period 2π/|B|, phase shift C/B, vertical shift D), https://openstax.org/books/precalculus-2e/pages/6-1-graphs-of-the-sine-and-cosine-functions (retrieved 2026-10-18)"
    }
  ],
  "sources": [
    "OpenStax, Precalculus 2e, §6.1 Graphs of the Sine and Cosine Functions: y = A sin(Bx − C) + D, amplitude |A|, period P = 2π/|B|, phase shift C/B (right for positive, left for negative), vertical shift D; Examples 1, 3, 4, 5, 9 and 10, retrieved 2026-10-18. https://openstax.org/books/precalculus-2e/pages/6-1-graphs-of-the-sine-and-cosine-functions"
  ],
  "related": [
    "sine",
    "trigonometry",
    "reference-angle"
  ],
  "changelog": []
}
