GateAI
Discrete Mathematics

GATE CSE 2026 Set 1 · Q57

NAT2 marksMedium

Time

Let GG be an undirected graph, which is a path on 8 vertices. The number of matchings in GG is ________. (answer in integer)

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 34

Discrete Mathematics

A matching in a graph is a set of edges without common vertices (including the empty set).

Let M(n)M(n) denote the number of matchings in a path graph PnP_n on nn vertices.

To find a recurrence relation for M(n)M(n):

  1. If the last edge (vn−1,vn)(v_{n-1}, v_n) is not included in the matching, the number of valid matchings is M(n−1)M(n-1).

  2. If the last edge (vn−1,vn)(v_{n-1}, v_n) is included in the matching, no other edge incident to vn−1v_{n-1} can be chosen, leaving M(n−2)M(n-2) valid matchings on the remaining n−2n-2 vertices.

Thus, the recurrence is:

M(n)=M(n−1)+M(n−2)M(n) = M(n-1) + M(n-2)

Base cases:

  • M(0)=1M(0) = 1 (empty path has 11 matching: the empty set)

  • M(1)=1M(1) = 1 (11 vertex has 11 matching: the empty set)

  • M(2)=2M(2) = 2 (11 edge: empty set or the edge itself)

Computing the values iteratively (which gives the Fibonacci numbers Fn+1F_{n+1} where F1=1,F2=1,F3=2,…F_1 = 1, F_2 = 1, F_3 = 2, \dots):

  • M(3)=2+1=3M(3) = 2 + 1 = 3

  • M(4)=3+2=5M(4) = 3 + 2 = 5

  • M(5)=5+3=8M(5) = 5 + 3 = 8

  • M(6)=8+5=13M(6) = 8 + 5 = 13

  • M(7)=13+8=21M(7) = 13 + 8 = 21

  • M(8)=21+13=34M(8) = 21 + 13 = 34

Therefore, the number of matchings in a path on 8 vertices is 34.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Discrete Mathematics previous year question is Q57 of the GATE CSE 2026 Set 1 paper. Find more GATE CSE PYQs on Discrete Mathematics in Engineering Mathematics, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Discrete Mathematics PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Discrete Mathematics in GATE CSE

Discrete Mathematics has 50 GATE CSE PYQs across 23 papers from 2011 to 2026. 6 of them are 2-mark NAT questions like this one, and GATE CSE 2026 Set 1 has 3.

How GATE tests Discrete Mathematics

More from GATE CSE 2026 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2026 Set 1 · Q57 · NAT

Let G be an undirected graph, which is a path on 8 vertices. The number of matchings in G is … (answer in integer)

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.