Why is the partial derivative of strain energy function with respect to strain equal to stress

In Elasticity, we have a strain energy function , $$W$$, that is a function of strain tensor, $$E$$.

Then the cauchy stress tensor, $$T$$ can be determined by: $$T_{ij}=\frac{\partial W}{\partial E_{ij}} \tag{\star}$$

First Question, does this equation hold for all elastic bodies? Or just linear elasticity?

Second, I am having trouble finding the intuition behind this relation. Could someone please help explain why the partial derivative of the strain energy with respect to strain components gives the stress components?

My attempt at deriving ($$\star$$)

The strain energy is the energy stored in a body due to deformation. And since we are considering elastic bodies, its equal to work done in order to deform it.

In 1D, for a beam of cross sectional area $$A$$ being stretched by a length of $$u_0$$ we can write an integral for work as :

$$Work = \int_{0}^{u_0}{\sigma(u)*A(u)*du}$$

where $$\sigma$$ is just the stress normal to the cross sectional area in this 1D case.

So, I can see how the stress tensor definitely plays a role in the strain energy, but I just can't figure out how to properly derive ($$\star$$). Can someone walk me through the derivation?

1. Yes, the relation $$\mathrm{stress}=d(\mathrm{strain\,energy\,density})/d(\mathrm{strain})$$ holds for all elastic bodies, not just linearly elastic bodies. This equation implies that all differential work goes into elastic strain energy, which holds even for nonlinearly elastic materials (e.g., hyperelastic materials). However, the equation wouldn't apply to plastic deformation, for example, in which substantial amounts of work are converted to heat and expended through the formation of crystal defects.

2. Regarding the intuition behind this equation, we can say that any way to add energy to a system involves two parameters (called thermodynamic conjugate variables): a generalized force and a generalized displacement. The first term is intensive; i.e., if you doubled the system size, then the generalized force would stay the same. The second term is extensive; if you doubled the system size, then this term would also double.

The simplest example of a generalized force and displacement is an actual force $$F$$ and displacement $$x$$ and the familiar equations $$w=\boldsymbol{F\cdot x}$$ and $$dw=F\,dx$$ for the work $$w$$. Another example is the pressure $$P$$ and volume $$V$$: $$dw=-P\,dV$$, with the minus sign appearing because pressure is compressive. Note how a gradient in pressure, the intensive variable, drives a shift in volume, the extensive variable. This effect is common for all of these pairs, whose units invariably multiply to give units of energy.

(This framework applies even to heating: the system energy $$U$$ increases with $$T\,dS$$, where gradients in temperature $$T$$ drive shifts in the entropy $$S$$. Here again, the units multiply to give units of energy.)

Yet another example of a conjugate pair is the stress and strain. Well actually, this isn't entirely true. If you look at the units, you'll see that the product of stress and strain has units of volumetric energy. So we can work with the elastic strain energy density or what you call above the strain energy function $$W$$, or we can work in terms of energy by multiplying by the volume, as in the fundamental relation for a first-order closed system under a general mechanical load: $$dU=T\,dS+\boldsymbol{\bar{\sigma}} V\,d\boldsymbol{\bar{\epsilon}}$$, where $$\boldsymbol{\bar{\sigma}}$$ and $$\boldsymbol{\bar{\epsilon}}$$ are the stress and strain tensors, respectively. (If the load is pressure, or equitriaxial compressive stress, then we recover the familiar $$dU=T\,dS-P\,dV$$.)

3. As for deriving your starred equation, I checked Nye's Physical Properties of Crystals and Ugural & Fenster's Advanced Strength and Applied Elasticity, and they proceed as you do: define the increase in strain energy from a uniaxial load applied to a differential element and then build up to the complete 3D case. For an isotropic material (which obeys generalized Hooke's Law), for example, Ugural & Fenster obtain a strain energy density of $$W=\frac{1}{2E}\left(\sigma_{x}^2+\sigma_{y}^2+\sigma_{z}^2\right)-\frac{\nu}{2E}\left(\sigma_{x}\sigma_y+\sigma_{y}\sigma_z+\sigma_{x}\sigma_z\right)+\frac{1}{2G}\left(\tau_{xy}^2+\tau_{yz}^2+\tau_{xz}^2\right).$$

Why the partial derivative of the strain energy with respect to strain components gives the stress components?

Because the volumetric density of elastic potential energy (I bet that's what you call "strain energy function", I'll use the "$$\Pi$$" letter for it) is a quadratic form over the deformation(strain) tensor $$\boldsymbol{\varepsilon}$$ $$\Pi = \frac{1}{2} \boldsymbol{\varepsilon} {\cdot\cdot} \boldsymbol{M} {\cdot\cdot} \boldsymbol{\varepsilon} = \frac{1}{2} \sum_{a,b,c,d} \varepsilon_{ab} M_{abcd} \varepsilon_{cd}$$ where the tetravalent tensor $$\boldsymbol{M}$$ with components $$M_{abcd}$$ is the tensor of elastic moduli (stiffness tensor).

Thus its derivative is $$\frac{\partial \Pi}{\partial \boldsymbol{\varepsilon}} = \boldsymbol{\varepsilon} {\cdot\cdot} \boldsymbol{M}, \quad \frac{\partial \Pi}{\partial \varepsilon_{cd}} = \sum_{a,b} \varepsilon_{ab} M_{abcd}$$

The second derivative is just the stiffness tensor $$\frac{\partial^2 \Pi}{\partial \boldsymbol{\varepsilon} \partial \boldsymbol{\varepsilon}} = \boldsymbol{M}, \quad \frac{\partial^2 \Pi}{\partial \varepsilon_{ab} \partial \varepsilon_{cd}} = M_{abcd}$$ — this can be taken as its definition. It is symmetric over pairs of indices $$M_{abcd} = M_{cdab}$$, plus inside each pair due to the symmetry of $$\boldsymbol{\varepsilon}$$: $$M_{abcd} = M_{bacd}$$, $$M_{abcd} = M_{abdc}$$

And there's also the Hooke's law in its most abstract formulation, saying that the stress tensor $$\boldsymbol{\sigma}$$ is equal to $$\boldsymbol{\sigma}(\boldsymbol{\varepsilon}) = \boldsymbol{\varepsilon} {\cdot\cdot} \boldsymbol{M} , \quad \sigma_{cd} = \sum_{a,b} \varepsilon_{ab} M_{abcd}$$

Finally, here's the energy definition of what is the stress tensor $$\boldsymbol{\sigma}(\boldsymbol{\varepsilon}) = \frac{\partial \Pi}{\partial \boldsymbol{\varepsilon}}$$

Does this equation hold for all elastic bodies? Or just linear elasticity?

Well, for finite strain theory there're many different measures of deformation(strain) and many different measures of stress. If you want something energy conjugate with the deformation gradient $$\boldsymbol{F}$$, take a look at the first Piola-Kirchhoff stress tensor $$\boldsymbol{T}$$, for that is $$\boldsymbol{T} = \frac{\partial \Pi}{\partial \boldsymbol{F}}$$ (here $$\Pi$$ is still the volumetric density of elastic potential energy)
or you may want the second Piola-Kirchhoff stress tensor $$\boldsymbol{S}$$, which is energy conjugate with the Cauchy-Green deformation $$\boldsymbol{C}$$ $$\boldsymbol{S} = \frac{\partial \Pi}{\partial \boldsymbol{C}}$$