# Simple problem regarding rectangular pulse shifting

So i have the following rectangular pulse:

$$h(t)=\begin{cases} 1 & 0

Now, i am supposed to create $$h(T-t)$$, and the problem is that i do it two different ways, and get two different results, and it is obvious that this is not possible. Anyway, here is what i have.

My first attempt is step by step building of the $$h(T-t)$$ from the $$h(t)$$, firstly, i "flipped" variable $$t$$. so i got $$h(-t)=\begin{cases} 1 & 0<-t< T \\ 0 & \text{otherwise} \end{cases}=\begin{cases} 1 & -T

Now, i add T to this, and i have $$h(T-t)=\begin{cases} 1 & -T

However, i've done this directly:

$$h(T-t)=\begin{cases} 1 & 0

Now, there is something wrong here, but i don't see any mistakes in any of the two cases. Any help appreciated!

Clearly, in this example you have $$h(t)=h(T-t)$$. The easiest way to see this is to check for which value of $$t$$ the argument becomes zero. So the point $$t=0$$ of the original function is mapped to the point $$t=T$$, and because you have $$-t$$ in the argument, the function is inverted on the time axis.
The mistake in your first approach is the way you added the value of $$T$$. What you should have done is replace $$-t$$ by $$T-t$$ (which is what's happening on the left-hand side of the equation), to obtain $$h(T-t)=1$$ for $$0, which is equivalent to $$0, corresponding to the correct solution.
They must yield the same answers. When you are in doubt, it's helpful to define an intermediate signal like $$y(t) = h(-t)$$ especially when manipulating the arguments. Then you have :
$$y(t) = h(-t)=\begin{cases} 1 & 0<-t< T \\ 0 & \text{ otherwise } \end{cases} = \begin{cases} 1 & -T
then since $$h(-t+T) = y(t-T)$$, you get : $$h(T-t) = y(t-T) = \begin{cases} 1 & -T< t-T < 0 \\ 0 & \text{ otherwise } \end{cases} = \begin{cases} 1 & 0< t < T \\ 0 & \text{ otherwise } \end{cases}$$