In order to know what "open relative to" means, you have to first know what "open" means:
A subset S of a metric space X is called open if, for every point p of S, there is a positive real number $\epsilon$ such that every point in X of distance less than $\epsilon$ from p lies in S.
Now, if we're working in some metric space and consider a subset A of that space, you can, if you wish, disregard the rest of the space and think of A as a metric space in itself. The notion of "open relative to A" is what you get when you realize, looking at the above definition, that some subsets of A that are not open subsets of the larger space may still be open subsets of A.
For example, suppose you look at the interval I=[0,1] as a metric space in itself, and disregard the rest of the real line. Then the subset S=(0.5,1] may seem at first not to be an open set, because you think, "Hey, there are points arbitrarily close to 1 that are not in S, so 1 is actually a boundary point!" Well, yes... except that none of those arbitrarily-close points are actually in I, so from the point of view of I as a space in itself, they don't exist. Every point in I sufficiently close to 1 is also in S, so if we want to work in I alone, we have to concede that S is open.
The moral of this story is that sets aren't inherently open: the definition depends on what metric space they are considered as subsets of. If you are only talking about one space it's harmless to just write "open," but otherwise you may have to be more specific. If you are considering both $\mathbb{R}$ and I, for example, writing "(0.5,1] is open" is ambiguous. So instead you write "(0.5,1]" is open relative to I."
What you are calling the range would more commonly be called the codomain of the function (the range is then defined as the image of the domain, i.e. for $f:A\to B$, the set $\{f(x) : x\in A\}$. With this in mind, the answer is:
- yes, whether a function is surjective depends on the codomain.
- no, whether a function is injective does not depend on the codomain (it depends on the domain)*
For example, the function $f:\mathbb R \to \mathbb R$ defined by $f(x)=x^2$ is not a surjection. But the function $g:\mathbb R \to \mathbb R^+ \cup \{0\}$ defined by $g(x)=x^2$ is a surjection.
In general, this is why we ought to specify the domain and codomain whenever we define a function: the functions $f$ and $g$ above are different functions even though they map the same inputs to the same outputs. Surjectivity is a property of a function fully defined, rather than something that can be determined just from the inputs and outputs.
Indeed, sometimes we rely on these facts in order to make a function invertible. For example, $\sin:\mathbb R \to \mathbb R$ is neither injective nor surjective, and hence does not have an inverse function. However, if we restrict it to the function $\sin: [-\frac{\pi}{2}, \frac{\pi}{2}] \to [-1,1]$ the new function is bijective and we can obtain $\sin^{-1}$.
*A sketch proof. Consider $f:A\to B_1$ and $g:A\to B_2$ where $f(x)=g(x)$ for all $x \in A$, and ensuring that $f(A)\subseteq B_1,B_2$ (a function cannot be defined with a codomain that does not include the range, so this assumption is not problematic). $f$ is injective iff $f(a_1)=f(a_2) \Rightarrow a_1=a_2$, and $g$ is injective iff $g(a_1)=g(a_2)\Rightarrow a_1=a_2$. But since $f$ and $g$ map $a_1$ and $a_2$ to the same elements of the range, these criteria are equivalent so $f$ is injective iff $g$ is. Hence injectivity does not depend on the choice of codomain.
Best Answer
Since not all notions in the question are defined, we try to guess their meaning. We have that $R^n$ probably is $\Bbb R^n$, $e_i$ is the standard basis vector of $\Bbb R^n$ such that its $i$-th coordinate is $1$ and the other coordinates are zeroes, given $x\in E\subset \Bbb R^n$, $x=\sum_{i=1}^n x_ie_i$ is the decomposition of $x$ with respect to the basis $\{e_i\}$, that is $x_i$ is the $i$-th coordinate of $x$ for each $1\le i\le n$. Then $G$ is primitive means that $G$ is the identity map on $E$ distorted on $m$-th coordinate for some $1\le m\le n$ by some function $g:E\to\Bbb R$. In particular, if $g(x)=x_m$ for each $x\in E$ then $G$ is the identity map.