On Twitter, Kevin Vallier recently asked:
Ok, philosophers, what’s the best reason to think that the universal law formulation of the categorical imperative and the humanity formulation are equivalent?
— Kevin Vallier (@kvallier) February 9, 2023
This is a good question, and I've known professional philosophers who definitely do not get this correct. Nonetheless, it's not actually a difficult question. There is more than one way you can establish it, but I'll give the way that I think is simplest and most straightforward.
When Kant gives the categorical imperative as such, he gives a version that says (allowing for slightly different wordings):
Act only according to that maxim whereby you can at the same time will that it should become universal law.
This sentence is intended to capture the idea of morality as having maxims appropriate to universal law. There are three essential ideas here: maxim, universal, and law. And to facilitate understanding and application of the categorical imperative, Kant gives three re-formulations of the categorical imperative that brings one of these ideas front and center. The Law of Nature formulation emphasizes 'universal' by drawing an analogy to the most universal thing that directly impinges on our experience (the laws of nature), and it focuses on the formal structure of moral action; the End in Itself formulation (also known as the Humanity formulation) emphasizes 'maxim', which is the rule we make for ourselves in making a choice, and it focuses on the material content of moral action; and the Kingdom of Ends formulation (sometimes called the Autonomy formulation) emphasizes 'law' as something applicable to rational beings, and it focuses on how the formal structure organizes the material content of our choices, which Kant thinks of as its totality or wholeness.
To derive the End in Itself formulation, therefore, we need to know what a 'maxim' is. On Kant's account of willing, maxims are rules that have a means-end structure. They say what you are treating as valuable (the end) and how you are to treat it as valuable (the means). The categorical imperative tells us that we should only have maxims that are universalizable. But no maxim can be universalizable unless it has an end that is already universal -- that is relevant to every possible choice of every possible rational being. What is such that in every possible choice, no matter what, made by any possible rational being, it will be something that can be treated as valuable? Nothing, Kant thinks, except rationality itself. Kant uses the word 'humanity' as the popularly accessible word indicating rational nature. Thus, the categorical imperative tells us that we need always to treat humanity as an end. This, with a few clarificatory comments whose value is simply that they rule out potential mistakes of interpretation, gives us the End in Itself formulation:
Treat humanity, whether in your own person or in the person of another, always as an end and never merely as a means.
Similar derivations work for the Law of Nature formulation and the Kingdom of Ends formulation. The reason that all three express the one categorical imperative is that in their essential meaning, they differ only by emphasis. Each takes one of the three ideas and emphasizes it, but the other two have to be included. You can vary up the vocabulary using analogies to other things (laws of nature, laws of societies, prudential rules), but the ideas have to be retained. In all cases you have to be talking about maxims conforming to universal law.
Are there any weak points in Kant's derivation of the formulations? With the End in Itself formulation a possible weak point is the assumption that only rational nature is available as something of worth for every rational choice of every rational being. But I suspect anything that one could add to it, Kant would just take to be included in 'humanity'.