Gradient LabSign up free

Home / GATE DA / 2025 / Q.34

GATE DA 2025, Q.34: Fit y = wx to three points

Machine learningLeast squares through the origin1 markNumerical answerFree

The question

Fit y = wx by least squares to (−1, 1), (2, −5), (3, 5). Find the optimal w to three decimals.

Watch it solved

Solve it step by step

  1. Loss. Σ (yᵢ − wxᵢ)².
  2. Set the derivative to 0. w = Σ xᵢyᵢ / Σ xᵢ².
  3. Plug in. (−1 − 10 + 15) / (1 + 4 + 9) = 4/14 = 0.286.

Answer: 0.286

Official IIT Roorkee answer key: 0.285 to 0.287.

Common mistake. Adding an intercept; the model has none, so the formula is Σxy / Σx², not the covariance ratio.

Remember. No-intercept least squares: w = Σxy / Σx².

See it move

Learn the idea behind this question in the free animated lesson Linear regression, then Loss functions.

Want every question solved? The past-paper pack has all 195 questions from 2024, 2025 and 2026 for ₹499. The cheat sheet pack has 23 printable sheets for ₹399.

See the past-paper pack See the cheat sheets

Source: official GATE DA 2025 question paper and answer key (IIT Roorkee). The question is lightly reworded; every number and option is kept.