# A Geometry problem that is giving me trouble

1. Jun 25, 2011

### Yondaime5685

So here is a picture I quickly made in photoshop that has the problem:

[PLAIN]http://img21.imageshack.us/img21/9406/trigproblem.png [Broken]

The rectangle's dimensions are known. (w & h) So it follows that the angle, "@", and the diagonal, "d", is also known. The width between the two black lines, "g", is known too. (I actually "slid" that line down to the end of the black line(The "bottom" one).) Also the black lines themselves are of the same length.

Basically everything that is in red is known and I need either x OR y in terms of the other "knowns."

Now in the paper that I drew this, I labeled more things such as all the possible angles that I saw or could create. I used law of cosines for that non-right triangle in the middle made up of d, y, and the length of one of the black lines. But I didn't label them on this picture since that would really clutter it up. I figured all those other things could be derived with the information from this picture and maybe even more that I missed.

I was hoping someone could help me find a relationship that gives me x OR y, since w is known, I just need one or the other.

This seems, at first, a doable trig problem, but when I started working on it, I found that it is not so simple.

So I would definitely appreciate any help on this problem. This is not a homework or some sort of hard teaser problem that was assigned in class. This popped up while I was doing my research work and I need to find "x" so that I can write finish writing my code for my research.

Last edited by a moderator: May 5, 2017
2. Jun 25, 2011

### micromass

Hi Yondaime568!

Because I will work with x and y coordinates, I will call your x by a. I won't use the y.

First, fix a coordinate axis on the rectangle. The leftbottom corner will be (0,0), the lefttop corner is (0,h) and the rightbottom corner is (w,0).

The straight line emanating from (0,h) will intersect the x-axis in (a,0). Thus the line has the equation

$$hx+ay-ha=0$$

A vector parallell to this line an emanating from (0,0) is (-a,h).

Let (s,r) be a vector normal to (-a,h), then this must satisfy

$$-sa+hr=0$$

and thus

(s,r)=(h,a) seems to be a good choice for a normal. Normalizing this normal to have length g yields the normal

$$\left(\frac{h}{g\sqrt{h^2+a^2}},\frac{a}{g\sqrt{h^2+a^2}}\right)$$

The line in your picture coming from (w,0) must go through

$$\left(\frac{h}{g\sqrt{h^2+a^2}},\frac{a}{g\sqrt{h^2+a^2}}+h\right)$$

The line parallell to $hx+ay-ha=0$ and through this point is

$$hx+ay-\frac{h^2}{g\sqrt{h^2+a^2}}-\frac{a^2}{g\sqrt{h^2+a^2}}-ha=0$$

Now you can check for yourself for which value of a that this line goes through (w,0). Thus you must find a such that the following is satisfied:

$$hw-\frac{h^2}{g\sqrt{h^2+a^2}}-\frac{a^2}{g\sqrt{h^2+a^2}}-ha=0$$

3. Jun 25, 2011

### Yondaime5685

Well first of all, thank you for replying.

I followed your steps and it makes sense. I was a bit uneasy in understanding the normalizing parts, but I trusted you. (It is definitely because of my limited knowledge than yours. :shy:)

So I decided to use your end result and I solved for a using Alpha:

http://www.wolframalpha.com/input/?i=solve%28h*w-%28%28h^2%29%2F%28g*sqrt%28h^2%2Ba^2%29%29%29-%28%28a^2%29%2F%28g*sqrt%28h^2%2Ba^2%29%29%29-h*a%3D0%2Ca%29

I then plugged in test values to get some numerical results. g=50 w=997 h=1200

But when I used these values, I didn't get a sensible answer:

http://www.wolframalpha.com/input/?i=%28%28g^2*h^2*w%29-%28sqrt%28g^2*h^4%2Bg^2*h^2*w^2-h^2%29%29%29%2F%28g^2*h^2-1%29+where+g%3D50+h%3D1200+w%3D997

Of course the other result would give me an answer if the second line was on the other side. But either way, clearly the "x", or "a" from your definition, is less than that. Actually it should be around 932. (I checked it with photoshop. In fact, that is where this whole problem arose from: writing a code that can manipulate an image. Now I can do it manually with no problem. But I need it automated. And that is where I need to know what "x" is in terms of the other knowns.)

Again I thank you for replying and I don't want to be a burden. :shy:

-edit

Actually what I really need is that angle that forms from the end of "x" and the end of the black line. (The one starting from the top left corner of the rectangle.) I figured that might help someone.

Last edited: Jun 25, 2011
4. Jun 25, 2011

### micromass

OK, I made a mistake on the normalizing part

Here's the corrected version

Because I will work with x and y coordinates, I will call your x by a. I won't use the y.

First, fix a coordinate axis on the rectangle. The leftbottom corner will be (0,0), the lefttop corner is (0,h) and the rightbottom corner is (w,0).

The straight line emanating from (0,h) will intersect the x-axis in (a,0). Thus the line has the equation

$$hx+ay-ha=0$$

A vector parallell to this line an emanating from (0,0) is (-a,h).

Let (s,r) be a vector normal to (-a,h), then this must satisfy

$$-sa+hr=0$$

and thus

(s,r)=(h,a) seems to be a good choice for a normal. Normalizing this normal to have length g yields the normal

$$\left(\frac{gh}{\sqrt{h^2+a^2}},\frac{ga}{\sqrt{h^2+a^2}}\right)$$

The line in your picture coming from (w,0) must go through

$$\left(\frac{hg}{\sqrt{h^2+a^2}},\frac{ag}{\sqrt{h^2+a^2}}+h\right)$$

The line parallell to $hx+ay-ha=0$ and through this point is

$$hx+ay-\frac{gh^2}{\sqrt{h^2+a^2}}-\frac{ga^2}{\sqrt{h^2+a^2}}-ha=0$$

Now you can check for yourself for which value of a that this line goes through (w,0). Thus you must find a such that the following is satisfied:

$$hw-\frac{gh^2}{\sqrt{h^2+a^2}}-\frac{ga^2}{\sqrt{h^2+a^2}}-ha=0$$

Wolfram alpha gave me as solution

$$a=\frac{gh\sqrt{h^2+w^2-g^2} -h^2w}{g^2-h^2}$$

I'll check it some more, but it makes more sense now...

5. Jun 25, 2011

### micromass

I've checked it with a graphics program and it is correct now!

6. Jun 25, 2011

### Yondaime5685

Yep, that does it! Thanks so much! This is going to help me out a lot. I wish I could give you something. So here are some http://freeinternetcookies.com/" [Broken]. You have to click yes.

Last edited by a moderator: May 5, 2017
7. Jun 26, 2011

### I like Serena

@MM: Hey micromass, I voted yea in your poll a little while back, but I never got the cookie your promised! Nor did anyone else I suspect! :grumpy:

8. Jun 26, 2011

### micromass

The cookies contained a virus :uhh: