Can you use $W = pdV = nRdT$ for an ideal gas with non-constant pressure? I am having trouble calculating the total work done on an ideal gas that is being adiabatically compressed.
Using the ideal gas law I can derive -- assuming n is constant -- that.
$$pV = nRT$$
$$V = \frac{nRT}{p}$$
$$dV = d\frac{nRT}{p}$$
$$W = pdV = pnRd\frac{T}{p}$$ and if p had been constant 
$$W = pdV = nRdT$$
Now my question is, can I use this equation for W when the pressure is not constant?
I would personally assume not but in the workbook I am using uses the formula $W = pdV = nRdT$ to solve this question. (I am not publishing the exact question here because I am uncertain about copyright)
 A: $p\ dV$ gives the work done by any fluid when its volume increases by an infinitesimal amount $dV$ in any conditions: adiabatic, isothermal, constant pressure...
The thing to remember is that $dV$ is an infinitesimal change. If $p$ changes as well, it will only change by an infinitesimal amount, $dp$. So although you could say that the work done is more like $\frac{p+(p+dp)}{2}dV$, $dp$ is utterly negligible compared with $p$ so we simply use $pdV$.
For example, in an isothermal expansion by an infinitesimal volume $dV$ the pressure change in an ideal gas is $dp=-(p/V)dV$ but the work done is still $pdV$.
A: You are reaching an incorrect conclusion for two basic reasons.
First, the ideal gas equation
$$pV=nRT$$
Does not describe a process. It only describes the relationship between pressure, volume and temperature of an ideal gas of a closed system ($n$ = constant) at any equilibrium state. 
Second, your equation
$$W=pdV$$
is not correct. It should be written 
$$dW=pdV$$
and then, to calculate reversible work between two equilibrium states, you have
$$W=\int_1^2 pdV$$
Which is called "boundary work" for a closed system, i.e., the work required to expand or compress the boundary of the system (ideal gas).
In order to calculate the work using the above formula, for any process you need to know how pressure varies as a function of volume. For a reversible adiabatic process the formula for an ideal gas is
$$pV^{ϒ}=C$$
where C is a constant and ϒ is the ratio $\frac{C_p}{C_v}$. This formula can be derived by combining the equations for the ideal gas law and the first law of thermodynamics. 
Rewriting this equation expressing pressure as a function of volume gives you
$$p=CV^{1-ϒ}$$
Putting this equation into the equation for the work done between two states
$$W=\int_1^{2}CV^{1-ϒ}dV$$
Which, after performing the integration, gives you
$$W=\frac{(p_{2}V_{2}-p_{1}V_{1})}{1-ϒ}$$
Now, for a constant pressure process, $p$ = constant, so the work is
$$W=\int_1^2 pdV=p\int_1^2dV=p(V_{2}-V_{1})$$
Hope this helps.
A: I would also assume that you cannot, if the pressure is non-constant. From the looks of this site: https://phys.libretexts.org/Bookshelves/University_Physics/Book%3A_University_Physics_(OpenStax)/Map%3A_University_Physics_II_-_Thermodynamics%2C_Electricity%2C_and_Magnetism_(OpenStax)/03%3A_The_First_Law_of_Thermodynamics/3.07%3A_Adiabatic_Processes_for_an_Ideal_Gas
You want to use: $$ d(pV) = d(RnT) $$
$$ pdV + Vdp = RndT $$
Hope that helps/makes sense!
A: To calculate the work done on an ideal gas along an adiabatic process you would not choose to use
$$ \delta W = p(V, T) dV $$
since neither $p, V, T$ are constant so its not so simple to just integrate the expression. But its even technical easier then that. You know that
$$ dU = \delta W + \delta Q$$
and for an adiabatic process $\delta Q = 0$ per definition. So you get $\delta W = dU$. And since the inner energy is a state variable its not dependent on the path you chose to get to that state. So you can conclude:
$$
\Delta W = \Delta U = \frac 3 2 N k_\text B ( T_2 - T_1)\quad, 
$$
since for an non interacting ideal gas $U = \frac 3 2 N k_\text B T$.
These temperatures can now be expressed by volume and pressure using:
$$ pV = Nk_\text B T$$ and the adiabatic formula:$$ pV^\gamma = \text{const.}$$
