Work done by a non constant force. Example 3. A 200-lb cable is 100 ft long and hangs vertically form the top of a tall building.

How much work is required to lift the cable to the top of the building?

I understood if you find the anti derivative to the definite integral of the formulas provided from 0 to 100.. you would get the same answer. But if you find the definite integral of any other interval you get different answers. For example 0 to 1. For the anti derivative of $200-2x$ which is $200x-x^2$ you get 199 vs the anti derivative of $2x$ which is $x^2$ you get 1. Both formula is stated to represent work done, but gives out different answers. So the two formulas must represent different things. For the $2x$ (anti derivative $x^2$) I imagine it to calculate the work done section by section so when you calculate say the interval of 0 to 1 you only get the answer of the work done moving a small section of the cable by 1 feet, exactly the section that only moved one feet when you pull the rope up the building and the answer you get does not equal to the whole cable moving one feet. So it does not equal to the total work done on the cable moving one feet up the building. The other formula I will need to have someone explain what it represent.

Also i do not understand what the textbook is saying at all when it stated let's place the origin at the top of the building and the x-axis pointing downward as in figure 2 not provided. We divide the cable into small parts with length $\Delta x$. If $X_i$ is a point in the $i$-th such interval, then all points in the interval are lifted by approximately the same amount, namely $X_i$. The cable weighs 2 pound per foot, so the weight of the $i$-th part is $2 \Delta x$. Thus the work done on the $i$-th part in foot-pounds is $2 \Delta x$ (force) $\times X_i $(distance). See image solution 2

And If had placed the origin at the bottom of the cable and the x-axis upward, we would have gotten see image solution 1
which give the same answer.

I don't get how orienting the x-axis upward or downward would give you different formula. I don't get what the textbook is saying. Please help
It seems you are a little confused about the physical meaning of your equations. The equation of the work done by a force $\vec F$ along a path $P$ is given by: $$W=\int_P\vec Fd\vec r$$
In the first solution, your reference frame is at the bottom of the building, with $x$-axis pointing up. If you move the chain up a distance $x$, the length of the chain is $100-x$, and the weight is $|\vec F|=200-2x$, acting downwards. But in this problem they don't ask "what is the work done by gravity?". They ask instead "what is the work done to overcome gravity?". The only difference is in the sign of the force. In the Solution 1, this force and displacement are in the same direction, so in order to lift the chain a distance $L$ you use $$W=\int_0^L(200-2x)dx$$
If you integrate to $L=1$ you just lift the chain one foot, so $99$ feet of the chain are still hanging from the building. To get the full work, just put $L=100$ and you get the answer.

In the second solution, they use the reference frame at the top of the building, pointing down. The length of the chain at some point in time is $x$, with weight $2x$. In the beginning $x=100$ feet, in the end $x=0$ feet. But now the force to overcome gravity is pointing upwards, while the $x$ axis is pointing down. Then the work done to lift the chain a distance $L$ is $$W=-\int_{100}^{100-L}2xdx=\int_{100-L}^{100}2xdx$$
If you look very carefully at the last equation, you might be able to guess that $$\int_{0}^{1}2xdx=-\int_{1}^{0}2xdx$$ is the work required to lift the last one foot of the chain.
Work $W=\int_S \mathbf F \cdot \mathbf{ds}$

Where $S$ is some path and $s$ some parameterization. See line/path integral. 

To add some technicalities, $S=\langle 0, s \rangle $ $$\int \mathbf F \cdot \mathbf ds= \int \mathbf F(S(s)) \cdot \langle 0, 1 \rangle ds$$

Again, see line and path integrals or even differential forms.

$$=\int  F_y(S(s)) ds $$

Now you know the cable weighs $200 lbs$ $\times \frac{s}{100}$

$$=\int 2s ds=[s^2]_{0}^{100}=10000-0$$