The president and Mr. Ryan, who will both campaign in Iowa on Monday, know each other well. For nearly four years, they have been leading antagonists in an increasingly rancorous debate over the size and scope of government, one forced by projections of unsustainable and mounting debt as the population ages and health care costs keep rising.

And while it is not uncommon for a presidential candidate to know his rival’s No. 2 better than he knows the rival — think Al Gore and Dick Cheney, former House colleagues, in 2000; or George Bush and Senator Lloyd M. Bentsen, two Texans, in 1988 — the history between Mr. Obama and Mr. Ryan, the chairman of the House Budget Committee, makes for an especially intriguing showdown.

The early failure of any partnership to take hold between Mr. Obama and Mr. Ryan reflects the broader failure of the president’s promise, the core of his 2008 campaign, to bridge the chasm between Democrats and Republicans in Washington. The switch in Mr. Obama’s approach to Mr. Ryan over time — from conciliatory outreach to aggressive pushback — mirrors his changed relations with Republicans in general.

The two men, for all their policy differences, have some similarities. Both are young — Mr. Obama just turned 51, Mr. Ryan is 42. Both are intelligent and policy oriented. Each is sure of himself and of the rightness of his views, though Mr. Obama is widely seen as more pragmatic while Mr. Ryan is proudly, conservatively ideological. And both are men in a hurry. Mr. Obama reached for the presidency just two years into his first Senate term, and Mr. Ryan is widely viewed — including by Mr. Obama, aides say — as someone with presidential ambitions.

In Mr. Obama’s first year of managing the financial crisis and the recession he had inherited, he and Mr. Ryan had little contact. Republicans then were the minority in the House, and Mr. Ryan had no committee chairmanship from which to push his “road map” plan for deep tax cuts, an overhaul of federal entitlement programs and other changes he sees as essential to restoring the nation’s economic strength.