The last unfinished picture by Richard Hamilton, one of the most admired and best-loved British artists of the 20th century, will be the centrepiece of a National Gallery exhibition on which he was working until the eve of his death last September.

Hamilton died just short of his 90th birthday, and in his last months he knew he would not get it finished and that the exhibition would prove a valedictory from beyond the grave. On his last working day he was completing the layout for the gallery's Sunley room, a labyrinth through earlier works leading to the last picture – which poignantly deals with the failure of art.

"This was the picture literally on his easel, or rather in his computer, on the day he died," curator Christopher Riopelle said. "The whole concept of the exhibition changed very much, shaped by his knowledge that it would be his last."

Hamilton, credited with launching the British pop art movement with his 1956 collage Just What Is It That Makes Today's Homes So Different, So Appealing?, was a passionate supporter of free admission to national collections. The exhibition, which could well have been a moneyspinning blockbuster like the Lucian Freud retrospective around the corner in the National Portrait Gallery, will be free.

In order to ensure that his chosen works would be available for the National Gallery, he deferred a major international touring show which will be seen at four cities in Europe and the United States, including the Tate in London, from next year.

It will include many works linked to his lifelong interest in the art of Marcel Duchamp, and to pictures in the National Gallery collection including his startling version of Fra Angelico's 15th-century Annunciation, with two naked women taking the places of the demure angel and Virgin.

The exhibition will culminate in three large working versions of his last work, inspired by a 19th-century short story by Honore de Balzac, The Unknown Masterpiece, in which an artist invites his peers to view a painting in which he claims to have created a nude indistinguishable from real life: they see only meaningless swirls and daubs of colour. In Hamilton's multi-layered version, the artists are based on self-portraits by Poussin, Courbet and Titian, standing by a reclining naked woman based on a 19th-century photograph, in turn referencing classical nudes including Titian's sexy Venus of Urbino.

The work will be titled The Balzac. Hamilton's widow, Rita, thought he would not like it called The Masterpiece, in case people thought he was claiming that honour for himself.

"The origin of the exhibition was one day when Nick [Nicholas Penny, director of the National Gallery] said: 'Come on, we're going to lunch at Richard's," Riopelle recalled. "The food was excellent, as always at Richard's, as was the wine, as always at Richard's. We probably had far too much for lunchtime – but at the end of it the germ of the exhibition was there. We lost two giants within a few months of one another last year in Hamilton and Freud. I'm not sure we're realised the scale of the loss yet."

Richard Hamilton: the Late Works is at the National Gallery, London WC2N, from 10 October to 13 January

Jonathan Jones: The final works of the visionary who invented pop art and became a prophet of the modern world go on show at the Nationalwhile the Barbican's downpour is poised to make a big splash – all in today's weekly art dispatch