```
Let S = set of triplets (A,B,C) where A ,B,C are subsets of {1,2,3.....n} E1 = event that a selected triplet at random from set S will satisfy $$ A cap B $$ cap C $$ = emptyset$ , $$ A cap B $$ is not equal to emptyset$ , B $$ cap C $$ is not equal to emptyset$. E1 = events that a selected triplets at random from set S will satisfy $$ A cap B $$ cap C $$ = emptyset$ ,
$$ A cap B $$ is not equal to emptyset$ , B $$ cap C $$ is not equal to emptyset$, A $$ cap C $$ is not equal to emptyset$.
.P(E) represents probablity of an events E then
Q.1 P(E1) is equal to
A) 7^n-6^n+5^n/8^n
B) 7^n+2*6^n+5^n/8^n
C) 7^n-2*6^n/8^n
D) 7^n-2*6^n+5^n/8^n
Q2. P(E2) is equal to
A) 7^n-3*6^n+5^n/8^n
B) 7^n-3*6^n+3*5^n-4^n/8^n
C) 7^n-2*6^n+2*5^n-4^n/8^n
D)7^n-6^n+5^n-4^n/8^n
Any help will be appreciated...Thanks .
```

# Tag: relations

## Question about Domain and Range of Relations

In the book I’m reading $Dom(R)$ is described as $Dom(R)={ain{A}|exists{bin{B}((a, b)in{R})}}$ but what does the $ain{A}$ mean in this context? When the author gave a proof of $Dom(R^{-1})=Ran(R)$ he "let $b$ be an arbitrary element of $B$" before proving it but why? I understand to prove the first way we let $bin{Dom(R^{-1})}$ then prove that $bin{Ran(R)}$ cause that’s how we prove subsets. I’m very confused. Do we always do this for proving $Dom(R)$?

## relations – Are these matrices transitive?

I have 2 matrices, I don’t believe that they are transitive but my friend is insisting that they are both transitive, is he correct?

**a)** $

begin{matrix}

1& 1 & 1 & 1 & 1 &1 \

0 & 1 & 0 & 0 & 1 & 0 \

0 & 0 & 0 & 0 & 0 & 0 \

0 & 0 & 0 & 0 & 0 & 0 \

0 & 1 & 0 & 0 & 1 & 0 \

1 & 0 & 0 & 0 & 0 & 1 \

end{matrix}

$

**b)** $

begin{matrix}

1& 0 & 0 & 0 & 0 &1 \

1 & 1 & 0 & 0 & 1 & 0 \

1 & 0 & 0 & 0 & 0 & 0 \

1 & 0 & 0 & 0 & 0 & 0 \

1 & 1 & 0 & 0 & 1 & 0 \

1 & 0 & 0 & 0 & 0 & 1 \

end{matrix}

$

I’m trying to order them by pairs of relation (using positions as letters, e.g. (a,b)) and failing for both.

Thank you.

## database design – Getting sums of multiple leveled relations efficiently

I’m currently building an API and a web app for an internal warehouse system using NET Core.

I have the core entity structure, that goes like this:

“Material” has many “MaterialSubtypes” has many “MaterialClasses” has many “Packs”.

Now, I need to create a list, representing a single sale. It can include lots of packs of different materials. The user should be able to add or remove packs to a sale as it is being prepared.

The problem is that I also need to show the user the list of all materials hierarchy that the sale contains, as well as the sum of “Quantity” field of all packs on each sublevel. This quantity is supposed to be updated dynamically in a client app.

What is the most efficient way to do this? Should I just add all packs to a sale, and then, on every GET request, Include everything and recalculate all sums via foreach loops? Or should I create separate entities for Material->MaterialSubtype->MaterialClass within the Sale and update them each time a Pack is added?

None of that seems optimal, but I can’t think of anything else.

## recurrence relations – Numerical method to solve difference equation

I am solving the following problem:

Write a program to generate the first 60 terms in the sequence given by the difference equation: $$x_{k+1}=2.25x_{k}-0.5x_{k-1}$$

with starting values $x_1=frac{1}{3}, x_2=frac{1}{12}$. The exact solution is given by $x_k=frac{4^{1-k}}{3}$. Make a semilog plot of the values you obtain as a function of k.

**My attemp:**

My program (in Octave) is the following:

```
function x=diff
n=60;
x(1)=1/3;
x(2)=1/12;
for i=3:n
x(i)=2.25*x(i-1)-0.5*x(i-2);
endfor
k=1:60;
semilogy(k,x)
endfunction
```

I performed the operations with the solution that they give me in the problem and I obtained the following graph:

But I don’t know where the problem is, in my opinion my code is correct. I tried to see if the solution was not correct, but the general solution for the difference equation is the following: $x_k=c_1 4^{-k}+c_2 2^k$, and with the initial values it agrees with the one given in the exercise.

Beforehand thank you very much.

## database design – MySQL how can you reach an entity that has no relations with any other entity, from another entity?

Assuming we have these entities:

Flight(flightID(PK), from, to, distance)

Aircraft (aircraftID(PK), name)

Certificate(aircraftID (PK), employeeID(PK)) foreign keys: aircraftID REFERENCES Aircraft(aircraftID), employeeID REFERENCES Employee (employeeID)

Employee(employeeID, name, salary)

My question is, is it possible to select all aircraft pilots for the flights that go from “A”city to “B”city by using SELECT, PROJECT, JOIN keywords etc.. If so, how?

A pilot is an employee who has a certificate for an aircraft.

I don’t think this is possible since flight entity does not have any foreign key relationship with any other entity. But this is a question from my midterm and my professor does not agree with me.

## relations – MySQL structure for many to many relationship

I have a `titles`

table, titles are movies or series. I want to suggest users similar titles so there is a one-to-many relation in the `title_suggestions`

table (`title_id`

, `suggestion_id`

which refers to another title). **The suggestions of a title may change at any time**.

The user requests my application to suggest based on a title and now I want to store each user suggestion request in my database and I am confused what is the best and correct way to do it.

can anyone help me with this?

## asymptotics – Can I use Master Theorem to solve recurrence relations with a constant in the recursive term?

If you are just interested in an upper bound you can notice that $T(n) le S(n)$ where $S(n) = 3 S(n/3) + frac{n}{2}$ and has solution $S(n) = O(n log n)$.

Alternatively there is always induction. You can show that, for $n ge 2$, $T(n) le c n log n$.

For $2 le n < 7$, $T(n)$ is a constant and $n log n ge 1$. Therefore the claim is true for a sufficiently large (constant) value $c^*$ of $c$.

For $n ge 7$ you have:

$$

T(n) = 3Tleft(frac{n}{3} – 2right) + frac{n}{2} le 3 c frac{n}{3} log frac{n}{3} + frac{n}{2}

= cn log n – cn log 3 + frac{n}{2},

$$

which is at most $cn log n$ when $c n log 3 ge frac{n}{2}$ or, equivalently, $c ge frac{1}{2 log 3}$.

Simply pick $c = max{c^*, frac{1}{2 log 3} }$.

## recursion – How to solve for multiple (cascading) recurrence relations

I am working with recurrence relations with a simple base:

begin{equation}

Y_i = aY_{i-1} + (1-a)X_i quad mbox{and if $Y_0=0$ then} quad Y_n = (1-a)sum_{i=1}^n a^{i-1} X_i tag{1}

end{equation}

here, $X_i$ are identically-distributed independent random variables (although I do not want to specify a distribution type). I am then interested to characterise the series $Y_n$ (its moments, correlation structure, etc.) in terms of those of $X$ and the parameter $a$.

I have done this by hand for (1) and have obtained relationships between $mathbf{E}(X_n)$ and $mathbf{E}(Y_n)$, $mathbf{Var}(X_n)$ and $mathbf{Var}(Y_n)$, $mathbf{skew}(X_n)$ and $mathbf{skew}(Y_n)$, $mathbf{Kurt}(X_n)$ and $mathbf{Kurt}(Y_n)$ and so on, up to order 6 moments. The algebra becomes rather tedious, but just about manageable.

However, I am now interested to feed this recurrence through a subsequent equation:

begin{equation}

Z_{j} = bZ_{j-1} + (1-b)Y_j quad mbox{and if $Z_0=0$ then} quad Z_n = (1-b)sum_{j=1}^n b^{j-1} Y_j tag{2}

end{equation}

and then find its moments. Having done that, I want to do it again.

My question is this: how (can ?) I use Mathematica to help me do this?

## recurrence relations – T(n)=3T(n/4)+n | T(1)=2

Please solve the recurrence relation

T(n)=3T(n/4)+n | T(1)=2

My solving

T(n)=3T(n4)+n ———-> 1

T(n/4)=3T(n/(4^2))+n/4 ——-> 2

T(n/(4^2))=3T(n/(4^3))+n/(4^2) ———–>3

Substituting this equations (2) and (3) in (1), we get

T(n) = (3^3)T(n/(4^3)) + ((3^2)n)/4^2 + 3n/4 + n

Generalizing it we get T(n) = (3^k)T(n/(4^k)) + n(1 + 3/4 + (3/4)^2 + … + (3/4)^k-1)

k = log4(n)

T(n) = (3^(log4(n)))*2 + 4n((3/4)^log4(n)-1)

How to solve it further ?