Calculate $x$, if $y = a \cdot \sin{}+d$

I am not an expert when it comes to trigonometric functions.

I need to calculate value of $x$ for a program.

If $y = a \cdot \sin{[b(x-c)]}+d$ then what will be the formula to calculate $x$?

Please help..

Solutions Collecting From Web of "Calculate $x$, if $y = a \cdot \sin{}+d$"

So this equation $y = a\cdot \sin[b(x-c)]+d$ can be rearranged as

$$\frac{y-d}{a}= \sin[b(x-c)]$$

Using the $\arcsin$ this can be rewritten as

$$\arcsin\left(\frac{y-d}{a}\right) + k\cdot 2\pi= b(x-c)$$

with $k$ an integer. This is so because the $\sin$ function is periodic with period $2\pi$ whereas the $\arcsin$ is actually the inverse of a truncated $\sin$.

Rearranging further:

$$c+\frac{1}{b}\arcsin\left(\frac{y-d}{a}\right) + \frac{2k\cdot \pi}{b}= x$$

Now, there is actually another set of solutions which follows from the fact that $\sin(a) = \sin(\pi – a)$. So that we also have

$$\arcsin\left(\frac{y-d}{a}\right) + k\cdot 2\pi= \pi-b(x-c)$$

or after reworking

$$c-\frac{1}{b}\arcsin\left(\frac{y-d}{a}\right) – \frac{(2k-1)\cdot \pi}{b}= x$$

Again, for $k$ being an integer.

Now, you might want to restrict your solution to angles between $[0,2\pi]$, in which case you don’t need the entire sets of solutions but just two of them. If you have further restrictions, there can be a unique solution.

Here’s a plot of what the solutions look like graphically:

Plot of a sinusoidal function and its intersection with a horizontal line

The red points correspond to my first formula

$$x_k = c+\frac{1}{b}\arcsin\left(\frac{y-d}{a}\right) + \frac{2k\cdot \pi}{b} \; ,$$

the green points correspond to my second one

$$x’_k=c-\frac{1}{b}\arcsin\left(\frac{y-d}{a}\right) – \frac{(2k-1)\cdot \pi}{b} \; .$$

It all boils down to the following:

If two real quantities $t$ and $s$ are related by the equation $$(*) \qquad s=\sin t$$ then for arbitrary $t\in{\mathbb R}$ the corresponding $s$ is uniquely determined and can, e.g., be evaluated by means of the $\sin$-series. The $s$-values appearing in this way turn out to be restricted to the interval $[-1,1]$.

The other way around the situation is more complicated. For a given $s\in\ [-1,1]$ there is a unique $T\in [-{\pi\over2},{\pi\over2}]$ that satisfies the equation $(*)$, and this particular $T$ is called $\ \arcsin s$. All other $t$ that satisfy $(*)$ can be obtained from this T, and by looking at the graph of the $\sin$-function one gets the following list of values:

If $s=-1$ then $T=-{\pi/2}$, and if $s=1$ then $T={\pi/2}$. In both these cases the complete set of $t$ satisfying $(*)$ is given by $\{T+2k\pi\ |\ k\in{\mathbb Z}\}$. If $s$ lies strictly between $-1$ and $1$ then each $t$-interval of length $2\pi$ contains ${\it two}$ points that satisfy $(*)$, and the complete set of such $t$ is given by $\{T+2k\pi\ |\ k\in{\mathbb Z}\}\ \cup\ \{(2k+1)\pi-T\ |\ k\in{\mathbb Z}\}$.

Well, as $\sin \circ \arcsin = id$ (it’s the other way around that is tricky), it should be rather simple for you to prove that:

x = (sin (y – d)) / b + c

The thing which some have hinted at, but not really emphasized is that it is impossible to derive x from y (in your equation); because, although your equation is a legitimate non-linear equation, its inverse is not. In other words: each value of x gives a uniques value of y; but if you re-arrange the equation to solve for x, each value of y can give an infinite number of values of x.

So, to make this look like a function (and get your answer, without all the ‘k’ values) you must restrict the argument of arcsin(z) such that -Pi/2 radians < z < +P1/2 radians. In your case, z = (y-d)/a.

$\arcsin[b(x-c)] = y – d \implies$

$b(x-c) = \sin(y-d) \implies$

$x=\sin(y-d)/b + c$