Our text presented a definition from the Second Vatican Council’s Dogmatic Constitution on the Church, Lumen Gentium, but we can get a very concise definition straight from the 1st Vatican Council, which defined this dogma in its Dogmatic Constitution on the Church of Christ, Pastor aeternus:
“…We teach and define as a divinely revealed dogma that when the Roman Pontiff speaks EX CATHEDRA, that is, when, in the exercise of his office as shepherd and teacher of all Christians, in virtue of his supreme apostolic authority, he defines a doctrine concerning faith or morals to be held by the whole Church, he possesses, by the divine assistance promised to him in blessed Peter, that infallibility which the divine Redeemer willed his Church to enjoy in defining doctrine concerning faith or morals.” Pastor aeternus 9
See https://www.ewtn.com/…/vatican-is-dogmatic-constitution… for the entire text.