Why gamma is not equal to 2? In my text book, I came across a ratio called heat capacity ratio or gamma which is equal to
$$\gamma = 1+\frac{2}{f}$$
where $f$ is degree of freedom. Therefore
$$C_p = \gamma C_v$$
where $C_p$ and $C_v$ are molar heat capacity at constant pressure and constant volume.
In an online lecture I came to know that energy given to a piston gas system is equally shared by piston and gas (when piston is movable).Amount of energy gained by piston is work done and by gas is change in internal energy.let us assume that change in internal energy dU cause change in temperature by 1 kelvin.  let us say that we have 1 mole of gas in a cylinder piston system So Cv is amount of energy needed to change temperature of our system by 1 kelvin when piston is immovabe ( constant volume) therefore Cv=dU and Cp be energy needed to do the same temperature change when piston is movable (constant pressure)so Cp=2dU in later scenario Cp is equally shared by gas and piston  therefore Cp must equal to 2Cv since Cv =dU .By definition I came to know that R is amount of energy needed to rise temperature of one mole of substance by one kelvin so  Cv must equal to R(gas constant) since Cv also defined in the  same way .But in my book It is said that  gamma is greater than one  and less than two (usually).why degree of freedom affect Cp Cv relation and Cv R relation? why Cp is not equal to 2 Cv ? why Cv is not equal to R ?why with increase in temperature gamma value decrease?
 A: In piston/cylinder gas problems the piston is usually considered massless and simply acts as the mechanism for the gas to do work on the surroundings, and there is no "energy gained" by the piston.  In any case, if you are dealing with an ideal gas you have made several incorrect assumptions.

So Cv is amount of energy needed to change temperature of our system
  by 1 kelvin when piston is immovable ( constant volume) therefore
  Cv=dU

For an ideal gas, $\Delta U=C_{v}\Delta T$ for any process  not just for a constant volume (immovable piston) process.

Cp be energy needed to do the same temperature change when piston is
  movable (constant pressure)so Cp=2dU

For an ideal gas, this is not correct. As indicated above, $\Delta U=C_{v}\Delta T$ for any process. 

By definition I came to know that R is amount of energy needed to rise
  temperature of one mole of substance by one kelvin so Cv must equal to
  R(gas constant)

This is also not correct. For an ideal gas $C_{v}=C_{p}-R$. So if you wanted to express the change in internal energy in terms of $C_{p}$, it would be
$$\Delta U=(C_{p}-R)\Delta T$$
Since your initial assumptions are incorrect, any conclusions you reach based upon them will be incorrect.
Finally, the minimum number of degrees of freedom for a gas is 3 (monatomic gas), in the x-y-z directions. That means the maximum value of gamma is 1.667. 
Hope this helps. 
A: Your mistake is you attribute 1 degree of freedom to the gas. In an ideal gas there are three degrees of freedom for every particle in the gas because each particle can move in three dimensions. The piston does have an equal share of the energy, but it only gets one degree of freedom for its ability to move in one dimension. Since there are about 1 mole of gas atoms, one more or less degree of freedom is completely irrelevant.
The $f$ in the equation $\gamma = 1 + \frac{2}{f}$ is degrees of freedom per particle in the gas.
Other answers have done a good job of dealing with the details of the equations, so I'm not going to reproduce them.
