#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · STEP BY STEP

Lagrange Interpolation Calculator: Estimate y From Unequal Data

Enter x and y values to interpolate with Lagrange's formula.

  • 📍 Unequal spacing
  • 📋 Lᵢ(x) table
  • 🧾 Polynomial P(x)

How to use the Lagrange Interpolation Calculator

  1. 1. Enter the x valuesType the known x values, separated by commas.
  2. 2. Enter the y valuesType the matching y values in the same order.
  3. 3. Choose xEnter the x where you want y and press Interpolate.

Lagrange's formula

Given n points (xᵢ, yᵢ), there is exactly one polynomial of degree n − 1 through all of them. Lagrange writes it as P(x) = Σ yᵢ Lᵢ(x), where Lᵢ(x) = Π (x − xⱼ)/(xᵢ − xⱼ) over all j ≠ i. Each Lᵢ is 1 at xᵢ and 0 at every other data point.

The x values do not need to be equally spaced, which is the big advantage over Newton's difference formulas. The tool also expands P(x) so you can see the polynomial itself.

Worked example

Given f(5) = 12, f(6) = 13, f(9) = 14 and f(11) = 16, find f(10).

L₀(10) = (10−6)(10−9)(10−11)/((5−6)(5−9)(5−11)) = −4/−24 = 0.1667. L₁(10) = (5)(1)(−1)/((1)(−3)(−5)) = −0.3333. L₂(10) = (5)(4)(−1)/((4)(3)(−2)) = 0.8333. L₃(10) = (5)(4)(1)/((6)(5)(2)) = 0.3333.

f(10) = 12(0.1667) + 13(−0.3333) + 14(0.8333) + 16(0.3333) = 14.6667. The four Lᵢ add up to 1, a quick check on your working.

Good practice

Interpolation is safe inside the range of your data. Outside it (extrapolation) the polynomial can swing wildly, and the tool warns you. With many points a single high-degree polynomial can wiggle between them, so use the nearest few points instead of all of them. For equally spaced data, the Newton forward difference table gives the same answer with a difference table.

Frequently asked questions

Do the x values need to be equally spaced?

No. Lagrange's formula works for any distinct x values.

Why do the Lᵢ values add up to 1?

Interpolating the constant function 1 must give 1 everywhere, so Σ Lᵢ(x) = 1 for any x.

How many points can I use?

Up to 15. In practice 3 to 6 nearby points give the most reliable estimates.

Is this calculator free?

Yes. You enter your name and WhatsApp number once when you see your result, and other Uncodemy tools then open without the form.

More free tools

See all free tools